Multiple SSH Keys settings for different github account
2021/7/30 6:09:14
本文主要是介绍Multiple SSH Keys settings for different github account,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
Multiple SSH Keys settings for different github account
create different public key
create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "your_email@youremail.com"
Please refer to github ssh issues for common problems.
for example, 2 keys created at:
~/.ssh/id_rsa_activehacker ~/.ssh/id_rsa_jexchan
then, add these two keys as following
$ ssh-add ~/.ssh/id_rsa_activehacker $ ssh-add ~/.ssh/id_rsa_jexchan
you can delete all cached keys before
$ ssh-add -D
finally, you can check your saved keys
$ ssh-add -l
Modify the ssh config
$ cd ~/.ssh/ $ touch config $ subl -a config
Then added
#activehacker account Host github.com-activehacker HostName github.com User git IdentityFile ~/.ssh/id_rsa_activehacker #jexchan account Host github.com-jexchan HostName github.com User git IdentityFile ~/.ssh/id_rsa_jexchan
Clone you repo and modify your Git config
clone your repo git clone git@github.com:activehacker/gfs.git gfs_jexchan
cd gfs_jexchan and modify git config
$ git config user.name "jexchan" $ git config user.email "jexchan@gmail.com" $ git config user.name "activehacker" $ git config user.email "jexlab@gmail.com"
or you can have global git config $ git config --global user.name "jexchan" $ git config --global user.email "jexchan@gmail.com"
then use normal flow to push your code
$ git add . $ git commit -m "your comments" $ git push
Another related article in Chinese
- http://4simple.github.com/docs/multipleSSHkeys/
这篇关于Multiple SSH Keys settings for different github account的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-23增量更新怎么做?-icode9专业技术文章分享
- 2024-11-23压缩包加密方案有哪些?-icode9专业技术文章分享
- 2024-11-23用shell怎么写一个开机时自动同步远程仓库的代码?-icode9专业技术文章分享
- 2024-11-23webman可以同步自己的仓库吗?-icode9专业技术文章分享
- 2024-11-23在 Webman 中怎么判断是否有某命令进程正在运行?-icode9专业技术文章分享
- 2024-11-23如何重置new Swiper?-icode9专业技术文章分享
- 2024-11-23oss直传有什么好处?-icode9专业技术文章分享
- 2024-11-23如何将oss直传封装成一个组件在其他页面调用时都可以使用?-icode9专业技术文章分享
- 2024-11-23怎么使用laravel 11在代码里获取路由列表?-icode9专业技术文章分享
- 2024-11-22怎么实现ansible playbook 备份代码中命名包含时间戳功能?-icode9专业技术文章分享