ubuntu20.04配置git

ubuntu20.04已安装好了git,接下来只需要配置git

1、配置用户名和邮箱

git config --global user.name "(这里填写你github上注册的名字)"
git config --global user.email “(这里填写你注册邮箱的名字)”
注意:之前我就已经在github上面注册过了,你自己要先注册,注册比较简单,这里就不教了。实在不行,自己百度一下。
之后:
git config  --list
回车就会显示你的注册名字和注册邮箱

2、SSH配置

ssh-keygen -t rsa -C ”(注册邮箱名)”
之后连续按三次回车就行了

查看密码

cat ~/.ssh/id_rsa.pub

登录github.com,在账号图片处点击“+”,进入setting

在这里插入图片描述

右侧点击SSH and GPG keys,出现如下画面后,点击New SSH key选项

在这里插入图片描述

 把从终端的复制的代码,粘贴在key表单中。title表单中,任意填写一个英文名字,之后,点击下方绿色选项。

3、验证

ssh -T [email protected]

中间时候 询问你yes/no,输入yes。
The authenticity of host ‘github.com (52.74.223.119)’ can’t be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
之后,显示如下:
Warning: Permanently added ‘github.com,52.74.223.119’ (RSA) to the list of known hosts.
Hi linuxidc! You’ve successfully authenticated, but GitHub does not provide shell access.

这样就显示你连接成功了。 

猜你喜欢

转载自blog.csdn.net/qq_24166417/article/details/107567368