Skip to content

Instantly share code, notes, and snippets.

@jcunanan05
Created June 24, 2019 18:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcunanan05/ba753c09cc20bfa6d3433a3ffd343fd1 to your computer and use it in GitHub Desktop.
Save jcunanan05/ba753c09cc20bfa6d3433a3ffd343fd1 to your computer and use it in GitHub Desktop.
# enable git push ssh on multiple repos
# delete cached
ssh-add -D
#1. go to your ~/.ssh
#2. open your favorite local editor
code ~/.ssh
# 3. add new ssh pub key
ssh-keygen -t rsa -b 4096 -C "my_work_email@my_company.com"
# 4. make your a ~/.ssh/config file and follow the example below
# in your repo, git config add your local user name and password
git config user.name "jcunanan05"
git config user.email "myemail@gmail.com"
# push/add the remote in your repo
git remote add git@github.com-mywork:jcunanan05/my-repo.git
git push -u origin master
@jcunanan05
Copy link
Author

jcunanan05 commented Jun 24, 2019

more info

go to this link https://gist.github.com/developius/c81f021eb5c5916013dc

sample ~/.ssh/config file

# Personal GitHub account
Host github.com
 HostName github.com
 User git
 AddKeysToAgent yes
 UseKeychain yes
 IdentityFile ~/.ssh/id_rsa

# Work GitHub account
Host github.com-mywork
 HostName github.com
 User git
 AddKeysToAgent yes
 UseKeychain yes
 IdentityFile ~/.ssh/mywork_rsa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment