Github account using multiple warehouse management

Method of operation

  1. Open the terminal orgit Bash
  2. Generate a public key and a private key

    1
    2
    $ ssh-keygen -t rsa -f ~/.ssh/id_rsa_1 -C "[email protected]" 
    $ ssh-keygen -t rsa -f ~/.ssh/id_rsa_2 -C "[email protected]"
  3. Create a configfile

    1
    touch config
  4. In configadd the following file

1
2
3
4
5
6
7
8
9
10
11
# one([email protected])
Host one.github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_1

# two(two@ gmail.com)
Host two.github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_2
  1. SSH key deployment
    were landed two github account, enter the Personal settings -> SSH and GPG keys , the corresponding .pubcontents added to it.
  2. Testing SSH link

    1
    2
    ssh -T [email protected]
    ssh -T [email protected]
  3. Set into the warehouse user

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    # Cancellation global user name / mailbox configuration 
    git config -global -unset user.name
    git config -global -unset user.email

    # Set individually for each repo username / mailbox
    git config user.email "[email protected]"
    git config user.name "One"

    git config user.email “[email protected]
    git config user.name “two”

Remark

If you are using hexo build blog, Part 7 should .deploy_gitbe a folder or directly modify .deploy_git.gitthe configfile, add the following:

1
2
3
[user]
name = one
email = [email protected]

Reference material

  1. A computer bind two github account tutorial
  2. git repository different accounts of different solutions

Original: Large column  using multiple github account management warehouse


Guess you like

Origin www.cnblogs.com/chinatrump/p/11606858.html