github常用命令及问题解决方法

命令一、设置ssh key

生成ssh key:

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

查看生成的ssh-key:

cd ~/.ssh
cat id_rsa.pub

github setting-》ssh and gpg keys-》new ssh key,将上面得到的ssh-key复制进去即可。

问题一、无法访问github

无法访问github,可以考虑使用镜像,目前常用的镜像有:  

http://git.what996.com

hub.fastgit.org

使用以下命令,则可以再git clone 时使用镜像地址取代github.com

git config --global url.http://git.what996.com.insteadof https://github.com

这个时候使用下面的命令查看配置,会发现多了url.http://git.waht996.com.insteadof ...

git config --list

如果想要取消设置,使用下面的命令,注意后面的url.http...和个人设置的有关系。

git config --unset --global url.http://git.what996.com.insteadof

扫描二维码关注公众号,回复: 14685119 查看本文章

猜你喜欢

转载自blog.csdn.net/qq_40035462/article/details/125790318
今日推荐