1. fatal: not a git repository ( or any of the parent directories)
2. error: switch 'm' requires a value
3. fatal:ambiguous argument 'head~5': unknow revision or path not in the working tree
4. Your local changes to the following files would be overwritten by merge
原因:
我跟同事修改了同一个文件,同事先提交了新代码,所以我在执行 git pull 之后会提示我的代码将会被git服务器上的代码覆盖
解决方法:
方法一
方法二(不推荐)
放弃本地修改,直接覆盖
1 git reset --hard
2 git pull
5. 新建一个分支执行 git pull 后报:There is no tracking information for the current branch. Please specify which branch you want to merge with. See git-pull(1) for details.
报错:
原因:是因为本地分支和远程分支没有建立联系 (使用git branch -vv 可以查看本地分支和远程分支的关联关系) .根据命令行提示只需要执行以下命令即可:
git push --set-upstream origin dev
下面的是网上的方法,还没有实践过:
git branch --set-upstream-to=origin/远程分支的名字 本地分支的名字
// 即
git branch –set-upstream-to=origin/new new
// 或 (new为新建分支名) 这样在我们每次想push或者pull的时候,只需要 输入git push 或者git pull即可
git branch –set–upstream new origin/new
// 否则的话, 你必须每次都这样做:
// 在此之前,我们必须要指定想要push或者pull的远程分支
git push origin new
git pull origin new
成功后:
6.git clone 时报错:error: RPC failed; curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054解决方法
只需要设置Git忽略ssl证书错误即可,使用下面的命令:
git config --global http.sslVerify "false"
..........................................................................................................
7.The file will have its original line endings in your working directory
原因:看情况应该是不同系统对换行的识别不到位导致的
就常识来说文件是在windows下生成的所以换行和 linux 确实不同可能是因为这个导致的
解决:
git config --global core.autocrlf false
补充
Git下处理“换行”(line ending)
core.autocrlf是git中负责处理line ending的变量,可以设置3个值:true,false,inout。
(1)设置为true【config --global core.autocrlf true】
当设置成true时,这意味着你在任何时候添加(add)文件到git仓库时,git都会视为它是一个文本文件(text file)。
它将把crlf变成LF。
(2)设置为false【config --global core.autocrlf false】
当设置成false时,line endings将不做转换操作。文本文件保持原来的样子。
(3)设置为input时,添加文件git仓库时,git把crlf编程lf。当有人Check代码时还是lf方式。因此在window操作系统下,不要使用这个设置。
参考:https://www.cnblogs.com/shijieli/p/10535051.html
持续更新中~
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。