Git configuration github and gitee on windows10

Git configuration github and gitee on windows10

  1. git download and configuration
    Download: https://git-scm.com/downloads
    Install directly to the next step. . . .
    Configuration: (https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration)

    $ git config --global user.name "你的名称"
    $ git config --global user.email 邮箱号
    
  2. Generate SSH key for github and gitee

    a. Open git Bash, run the following command, just press Enter during the process

    $ ssh-keygen -t rsa -C 'github邮箱号' -f ~/.ssh/id_rsa_github
    $ ssh-keygen -t rsa -C 'gitee邮箱号' -f ~/.ssh/id_rsa_gitee
    

    b. At this time, the following files will be generated in your user home directory (W: C:\Users/windows account name.ssh, L/M: ~/.ssh):
    01

  3. Log in to github and gitee respectively to add SSH KEY (take gitee as an example below)

    Enter the personal setting directory:
    02
    It should be noted that the content of the .pub file in the above generated file is copied in the public key column, namely: id_rsa_gitee.pub

  4. Configure the config file
    Enter the .ssh directory and create a new config file

    $ cd ~/.ssh
    $ touch config
    $ vim config
    

    Enter the following:

    # gitee
    Host gitee.com
    HostName gitee.com
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/id_rsa_gitee
    # github
    Host github.com
    HostName github.com
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/id_rsa_github
    

    Save and exit

  5. test

    $ ssh -T [email protected]
    Hi dubulingbo! You've successfully authenticated, but GITEE.COM does not provide shell access.
    $ ssh -T [email protected]
    Hi dubulingbo! You've successfully authenticated, but GitHub does not provide shell access.
    

    The above results show that the configuration is successful!

Guess you like

Origin blog.csdn.net/dubulingbo/article/details/108549185