git

git config --global user.name "hanyuntao"
git config --global user.email "hanyuntaocn@163.com"
git init
git add .
git commit -m "提交文件"
git remote add origin https://github.com/hanyuntao/text.git
git pull --rebase origin master
git push -u origin master

https://www.cnblogs.com/lightmain-blog/p/15651289.html

1.用户名出错

请使用

git config user.name
git config user.email

命令来检查自己在git中设置的用户名是否正确。如果不正确,请使用

git config --global user.name "xxx"
git config --global user.email "xxx"

命令来重新设置,并要重新设置远程链接的仓库

git remote rm origin
git remote add origin https://github.com/XXX

此段参考:https://www.cnblogs.com/fairylyl/p/15059437.html

2.解除SSL验证

执行以下代码:

git config --global http.sslVerify "false"

注意,执行之后要重启git bash,不然这一条不会生效。这一点在很多文章中都没有点出。

如果提示:

fatal: not in a git directory

那就先执行

git init

再输入:

git config http.sslVerify "false"

此段参考:第1条的那篇文章,以及https://blog.csdn.net/GaoJuno23/article/details/121682039,以及第6条的那篇文章。

3.网络连接不畅

请使用

ping github.com

来验证能否连接上github。如果不能,请找个办法连上去。

4.文件太大了

请使用

git config http.postBuffer 5242880003

来扩大缓冲区(这个命令中扩大到的大小约为512MB)。

此段参考:第1条的那篇文章。

5.DNS缓冲区

cmd中执行命令:

ipconfig /flushdns

但是实测,好像在git中也可以。

此段参考:第1条的那篇文章。

6.host设置错误

第一步,在https://www.ipaddress.com/上查询github.com的域名。

第二步,找到C:\Windows\System32\drivers\etc中的host文件,用记事本打开,加一行 [域名] github.com (不含方括号)。然后保存。

第三步,如果无效,试试重启电脑。

参考文章:https://blog.csdn.net/ywsydwsbn/article/details/118304909

-----分割线-----

忙活一个下午,终于把我的工程上传到了github上了。

如果有执行了以上六条都没有效果的,试试重启git bash;如果还没有效果的,试试重启电脑;如果仍然没有效果,请在评论区告诉大家,探究解决方法,让我们对这个问题有更全面的了解。

另外,关于从安装git到上传一个项目的全过程,有参考文章:
https://blog.csdn.net/weixin_41931602/article/details/81284835

 

posted on 2020-05-22 15:23  medsci  阅读(109)  评论(0编辑  收藏  举报