GitHub上传文件问题总结

问题一:git warning: LF will be replaced by CRLF in 解决办法

在Git Bash中输入git add .时出现上述语句。

解决办法:

输入以下语句:

1 $ git config core.autocrlf false

,这样设置git的配置后在执行add操作就没有问题了。

 

问题二:On branch master nothing to commit, working tree clean

在Git Bash中输入 git commit -m " " 时出现下列语句:

On branch master nothing to commit, working tree clean

On branch master nothing to commit, working tree clean

含义是:项目没有被修改,不需要提交。也就是说:修改->add->修改->commit只能commit已经add的修改。

问题解决:

若要保存第二次修改需要再一次add然后commit

 

问题三:fatal: could not open '.git/COMMIT_EDITMSG': Permission denied

在Git Bash中输入 git commit -m " " 时出现下列语句:

fatal: could not open '.git/COMMIT_EDITMSG': Permission denied

解决办法:

输入以下语句:

1 $ chmod 664 COMMIT_EDITMSG

问题四:fatal: the remote end hung up unexpectedly

在输入git push origin master之后出现fatal: the remote end hung up unexpectedly ,表示上传文件太大,导致上传失败。

解决办法:

参考博客:https://www.cnblogs.com/hanxianlong/p/3464224.html

问题五:fatal: refusing to merge unrelated histories

在输入下拉语句 git pull origin master之后出现fatal: refusing to merge unrelated histories,这个问题是因为这是两个不想干的Git库,一个是本地库,一个是远端库,然后本地与远端不相干,所以告知无法合并。

解决办法:

使用强制方法:

1 git pull origin master --allow-unrelated-histories

后面加上 --allow-unrelated-histories ,参数的意思是合并仓库的时候,允许不相关的历史的提交内容,后面再push就可以了 。

原文地址:https://www.cnblogs.com/zyh19980816/p/11830060.html