以 Vagrant & 结尾的修改行ZSH [英] amended line ending with Vagrant & ZSH
问题描述
我有一个 vagrant box,我将默认的 Ubuntu shell 更改为 oh-my-zsh
.我有一个包含 .zshrc
的共享文件夹,我在配置期间将其复制到 vagrant 主文件夹.在某些时候,在 .zshrc
中以一行结尾的行附加了 ^M
所以当我 vagrant ssh
时我收到以下错误:
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: 没有那个文件或目录:/home/vagrant/.oh-my-zsh/oh-my-zsh.sh^M
^M
在 .zshrc
文件中不可见.如果我在 vagrant 框中使用 vim 并重新编写 .zshrc
文件,那么一切都会按预期进行.
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.
如何确保我的 .zshrc
在 git clone
-ing repo 和 vagrant up<的过程中不会附加此行结束符
-框?
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?
我在 Windows 7 中使用 Vagrant.
I'm using Vagrant in Windows 7.
推荐答案
基于 这个你可以在git中做如下设置
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
这篇关于以 Vagrant & 结尾的修改行ZSH的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!