douzhuo8312
2013-10-10 20:12
浏览 81
已采纳

由于gitattributes,通过composer安装symfony / symfony时出错

I'm going to post this, then post the answer since it drove me crazy until I figured out the issue.

When installing symfony/symfony via composer, the process was repeatedly aborting due to this error:

[RuntimeException]                                                                                                                        
  Failed to execute git checkout 'fc0a09a2052e9275c16b5ab7af426935fe432f39' && git reset --hard 'fc0a09a2052e9275c16b5ab7af426935fe432f39'  

  error: Your local changes to the following files would be overwritten by checkout:                                                        
    src/Symfony/Component/Validator/Resources/translations/validators.bg.xlf                                                                 
  Please, commit your changes or stash them before you can switch branches.                                                                 
  Aborting   

I know it has something to do with git changing whitespace or line-endings on clone, then when it tries to checkout the specific commit, it fails since the line-endings have now been changed. git config core.autocrlf input didn't help.

图片转代码服务由CSDN问答提供 功能建议

我要发布这个,然后发布答案,因为它让我发疯,直到我发现问题为止。

通过composer安装symfony / symfony时,由于此错误,该进程反复中止:

  [RuntimeException] 
无法执行 执行git checkout'fc0a09a2052e9275c16b5ab7af426935fe432f39'&&  git reset --hard'fc0a09a2052e9275c16b5ab7af426935fe432f39'
 
错误:以下文件的本地更改将被checkout覆盖:
 src / Symfony / Component / Validator / Resources / translations / validators.bg.xlf 
请, 在切换分支之前提交更改或存储它们。  
正在中止
   
 
 

我知道它与克隆上的git更改空格或行结尾有关,然后当它尝试检出特定提交时,它会失败 因为线路结束现在已经改变了。 git config core.autocrlf input 没有帮助。

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doubinduo3364 2013-10-10 20:19
    已采纳

    In ~/.gitattributes I had this line:

    * text=auto
    

    Removing it and ensuring core.autocrlf is set to "input" or "false" will fix this issue.

    FWIW, I'm on a Mac and I've had similar issues with Homebrew that I'm hoping this fixes.

    已采纳该答案
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题