文章目录
  1. 1. Git Configration for github
    1. 1.1. Set User name and email
    2. 1.2. Check SSH key
    3. 1.3. Generate SSH key
    4. 1.4. Add key to ssh-agent
    5. 1.5. Github to set the SSH key from id_rsa.pub

Git Configration for github

Set User name and email

1
2
3
# Use your own name and email
git config --global user.name "galaxy2416"
git config --global user.email "gin@mail.dlut.edu.cn"

Check SSH key

1
2
cd ~/.ssh
ls

Generate SSH key

1
2
# Use own email
ssh-keygen -t rsa -C "gin@mail.dlut.edu.cn"

get the id_rsa和id_rsa.pub(default)

Add key to ssh-agent

1
2
3
4
# start the ssh-agent in the background
eval "$(ssh-agent -s)"
# add the key
ssh-add ~/.ssh/id_rsa

Github to set the SSH key from id_rsa.pub

1
2
3
# Test
ssh -T git@github.com
# Hi galaxy2416! You’ve successfully authenticated, but GitHub does not provide shell access.
文章目录
  1. 1. Git Configration for github
    1. 1.1. Set User name and email
    2. 1.2. Check SSH key
    3. 1.3. Generate SSH key
    4. 1.4. Add key to ssh-agent
    5. 1.5. Github to set the SSH key from id_rsa.pub