One Mac, Many Gits to Rule Them All
Jessica Rudd, PhD, MPH, PStat?
Senior Data Engineer - Analytics Modernization Capability Lead @ Intuit Mailchimp | Pipelines and modeling
Mastering the Art of Multitasking GitHub Accounts on Your Apple Silicon Mac
Happy Tuesday (because I forgot to post yesterday)!?Time to make your week awesome! Today’s Data Bytes calories: 669 words … 4 minutes.
??What I’m reading -?Building LLM applications for production-??Chip Huyen?digs deep into the challenges of productionalizing LLM applications, exposure of LLM limitations due to lack of engineering rigor/good practices, and some cool, enterprise-level applications.
??What I’m working on -?Last week I introduced the my first end-to-end web app,?Heat Pace Planner. I’ve fixed some bugs and currently working on updating the pace adjustments to take air quality (AQI) into account.
One Big Thing: Manage Multiple GitHub Accounts on MacOS (with Apple silicon)
Why do developers always have a backup plan?
…
Because they’re always ready to (git) commit and (git) push through any situation!
Do you have multiple GitHub accounts for different project and/or personal and professional work? Every try to push a commit to a remote repository only to get an unauthorized error and realize the local repository is tied to the incorrect credentials? Multiple GitHub accounts are common for personal and professional projects. Follow this step-by-step guide to streamline your workflow and seamlessly switch between accounts using SSH keys.
Step 1: Install Git & SSH Tools
? Make sure Git is installed: `$ git --version`
? Update to the latest version: `$ brew upgrade git`
? Verify SSH tools: `$ ssh -V`
? Update SSH tools (if needed): `$ brew install openssh`
Step 2: Create SSH keys for each account
Personal account example: `$ ssh-keygen -t ed25519 -C "[email protected]" -f ~/.ssh/id_ed25519_personal`
? Work account example: `$ ssh-keygen -t ed25519 -C "[email protected]" -f ~/.ssh/id_ed25519_work`
? Enter a passphrase for each key (optional, but recommended).
Step 3: Add SSH keys to SSH agent
? Run: `$ eval "$(ssh-agent -s)"`
? Add personal key: `$ ssh-add ~/.ssh/id_ed25519_personal`
? Add work key: `$ ssh-add ~/.ssh/id_ed25519_work`
Step 4: Create SSH config file
? Create a config file: `$ touch ~/.ssh/config`
? Open with a text editor, then add these entries:
领英推荐
Host github.com-persona
?HostName github.com
?User git
?IdentityFile ~/.ssh/id_ed25519_personal
Host github.com-work
?HostName github.com
?User git
?IdentityFile ~/.ssh/id_ed25519_work
Step 5: Add SSH keys to GitHub accounts
? Copy personal key: `$ pbcopy < ~/.ssh/id_ed25519_personal.pub`
? Paste into GitHub Personal Settings > SSH & GPG keys > New SSH key.
? Repeat for work key, copying & pasting `~/.ssh/id_ed25519_work.pub`.
Step 6: Configure Git user details
? Set global user details (I usually set this to whichever credentials I use the most):
?$ git config --global user.name "Your Name
?$ git config --global user.email "[email protected]""
? Configure local user details for each repository (for local repositories that don’t use the default global credentials):
?$ cd /path/to/your/personal/repositor
?$ git config user.name "Your Name"
?$ git config user.email "[email protected]"y
Step 7: Clone & use repositories
? Clone personal repo: `$ git clone [email protected]:username/repo.git`
? Clone work repo: `$ git clone [email protected]:username/repo.git`
? Seamlessly switch between accounts & repositories by configuring local repository user details where needed.
Git Commit …
? M1 Mac users can now manage multiple GitHub accounts with ease.
? Utilize SSH keys to simplify authentication & streamline workflow.
? Enjoy an efficient GitHub experience on your M1 Mac.
Helpful Resources
?? One last bite
“Sometimes the mistakes are what makes a work great. Humanity breathes in mistakes.” ~ Rick Rubin, The Creative Act: A Way of Being
Thank you for reading Data Bytes. This post is public, so feel free to share it.