Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# 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

This comment has been minimized.

Copy link
Owner Author

@jcunanan05 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