以 Vagrant & 结尾的修改行ZSH [英] amended line ending with Vagrant & ZSH

查看:32
本文介绍了以 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.

如何确保我的 .zshrcgit 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 &amp; 结尾的修改行ZSH的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆