amended line ending with Vagrant & ZSH

≡放荡痞女 提交于 2019-12-12 04:31:52

问题


I have a vagrant box where I change the default Ubuntu shell to oh-my-zsh. I have a shared folder containing a .zshrc that I copy to the vagrant home folder during provisioning. At some point the line ending for one line in the .zshrc has ^M appended to it so I get the following error when I vagrant ssh:

/home/vagrant/.zshrc:source:4: no such file or directory: /home/vagrant/.oh-my-zsh/oh-my-zsh.sh^M

The ^M is not visible in the .zshrc file. If I use vim in the vagrant box and re-write the .zshrc file then everything works as expected.

How can I ensure my .zshrc won't have this line ending character appended during the process of git clone-ing the repo and vagrant up-ing the box?

I'm using Vagrant in Windows 7.


回答1:


based on this you can make the following setting in git

git config --global core.autocrlf false
git config --global core.eol lf

and you will have no issues when cloning the project



来源:https://stackoverflow.com/questions/37317738/amended-line-ending-with-vagrant-zsh

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!