git ssh配置及使用

git ssh配置及使用

设置git的username和email(如果是第一次的话)

git config --global user.name "momo-0902"
git config --global user.email "[email protected]"

检查是否有ssh key

cd ~/.ssh
ls

如果存在id_isa和id_isa.pub文件,证明已经存在ssh key,可跳过生成密钥这一步骤

生成密钥

ssh-keygen -t rsa -C "[email protected]"

生成id_isa和id_isa.pub两个文件

将id_isa.pub文件中的密钥复制添加到github的ssh key设置里

将本地仓库.git文件夹下config文件里的url改成ssh的地址

可使用ssh -T git@github

成功后提示信息为

Hi MOMO-0902!(你的用户名) You've successfully authenticated, but GitHub does not provide shell access.

猜你喜欢

转载自blog.csdn.net/weixin_38318244/article/details/80162803
今日推荐