Git和GitHub的关联

Git的配置:

$ git config --global user.name "Firstname Lastname"
$ git config --global user.email yourEmailAdress
$ git config --global core.editor vim
$ git config --global merge.tool vimdiff

这个命令会在~/.gitconfig中创建你的个人信息

  • 名字

  • 电子邮件

  • 文本编辑器

  • 差异分析工具

$ git config --list

**这个命令可以显示你当前的信息**

user.name=Tom Black
[email protected]
core.editor=vim
merge.tool=vimdiff

设置SSH Key

$ ssh-keygen -t rsa -C "[email protected]"
Generating public/private rsa key pair.
Enter file in which to save the key
(/Users/your_user_directory/.ssh/id_rsa): 按回车键
Enter passphrase (empty for no passphrase): 输入密码
Enter same passphrase again: 再次输入密码

出现如下结果

Your identification has been saved in /Users/your_user_directory/.ssh/id_rsa.
Your public key has been saved in /Users/your_user_directory/.ssh/id_rsa.pub.
The key fingerprint is:
fingerprint值 [email protected]
The key's randomart image is:
+--[ RSA 2048]----+
|     .+   +      |
|       = o O .   |
 略

进入GitHub官网假定你已经注册settings->SSH and GPG keys->New SSH key

你需要填写一个任意有意义的Title

key:

$ cat ~/.ssh/id_rsa.pub
ssh-rsa 公开密钥的内容 [email protected]

测试

$ ssh -T [email protected]
The authenticity of host 'github.com (207.97.227.239)' can't be established.
RSA key fingerprint is fingerprint值 .
Are you sure you want to continue connecting (yes/no)? 输入yes

成功

猜你喜欢

转载自blog.csdn.net/weixin_38709708/article/details/81357738