我正在尝试修复Windows上的CRLF问题.
如何查看core.autocrlf系统上配置设置的值是什么?
我跑了一个
git add -A
Run Code Online (Sandbox Code Playgroud)
在我的第一个git项目上.
我收到了大约一千条回复:
"警告:LF将被CRLF取代"
因为它经历了每个文件(Ruby文件,有些是宝石).
我删除了我的.git目录并尝试通过键入以下命令禁用此默认设置:
git config core.autocrlf false
Run Code Online (Sandbox Code Playgroud)
然后我尝试再次添加文件:
git add -A
Run Code Online (Sandbox Code Playgroud)
但我得到了同样的结果.救命!
我最初尝试推送我的(第一次!)git repo:
$ git push helloworld
Run Code Online (Sandbox Code Playgroud)
但我得到了回报:
To git-smichaels@free5.projectlocker.com:helloworld.git
! [rejected] HEAD -> master (non-fast forward) error:
failed to push some refs to 'git-smichaels@free5.projectlocker.com:helloworld
git'
Run Code Online (Sandbox Code Playgroud)
所以我找到了另一个关于"修改提交"的StackOverflow问题,并从那里尝试了一个建议而不知道它是否会对我有所帮助:
KaiserSosa@SMICHAELS /c/test/helloworld (master)
$ git push helloworld +master:master
Run Code Online (Sandbox Code Playgroud)
有效!
但我不知道为什么它解决了我的问题:(
有人可以解释为什么这有效,但" git push helloworld"不是吗?
如果你在Windows上设置这样的东西:
git config --global core.autocrlf false
Run Code Online (Sandbox Code Playgroud)
这个全局设置写在哪里?
我在projectlocker上设置了一个git项目来推送我的git文件.然后我进入了初始化git项目并暂存我的文件的目录.最后我尝试使用此命令将项目推送到projectlocker:
$ git push git-smichaels@free5.projectlocker.com:helloworld.git
Run Code Online (Sandbox Code Playgroud)
它会生成此错误:
warning: You did not specify any refspecs to push, and the current remote
warning: has not configured any push refspecs. The default action in this
warning: case is to push all matching refspecs, that is, all branches
warning: that exist both locally and remotely will be updated. This may
warning: not necessarily be what you want to happen.
warning:
warning: You can specify what action you want to take in this case, and
warning: …Run Code Online (Sandbox Code Playgroud)