linux上git clone时遇到
fatal: unable to access 'https://github.com/xx/xx.git/': Failed connect to github.com:443; Connection timed out时如图

解决方法:把https:改成git

git clone git@github.com:xx/xx.git

如果没有成功,遇上以下报错

no such identity: /root/.ssh/id_rsa: No such file or directory
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

配置用户名,邮箱

git config --global user.email "123@126.com"

给该邮箱设置公钥

ssh-keygen -t rsa -C "123@126.com"

回车三次后 得到如图

 设置成功后进入~/.ssh,

 cd ~/.ssh
cat id_rsa.pub

 

 复制公钥(ssh-rsa到邮箱那一块就是了)到github上的settings上添加设置的公钥

 

后面再回linux上重新克隆就没有问题了 

 

点击阅读全文
Logo

更多推荐