Original link: https://blog.forecho.com/local-use-of-multiple-github-accounts.html
introduction
If you are also trying Github hosting code in the company, you may encounter a problem, using your personal account and company account locally at the same time.
Then this article will share with you how to use multiple Github accounts locally at the same time.
ssh configuration
Generate the ssh needed for the job
By default, you already have a personal ssh key, if not, you need to generate a personal ssh key first.
configure host
1 2 3 4 5 6 7 8 9 10 11
|
Host * ServerAliveInterval 60 #default github Host github.com HostName github.com IdentityFile ~/.ssh/id_rsa Host w.github.com HostName github.com IdentityFile ~/.ssh/work
|
use
If you want to use the work key, then clone the code like this
Configuring Git User Issues
Cancel the global optional first
1 2
|
git config --global --unset user.name git config --global --unset user.email
|
Configure Personal SSH
1 2 3 4 5 6
|
[user] name = forecho email = [email protected] [includeIf "gitdir:~/work/"] path = ~/work/.gitconfig
|
The working directory is set separately
examine
This article is transferred from: https://blog.forecho.com/local-use-of-multiple-github-accounts.html
This site is only for collection, and the copyright belongs to the original author.