解決git pull出現: Your local changes to the following files would be overwritten by merge: ...的問題

今天在服務器上git pull是出現如下錯誤:php

error: Your local changes to the following files would be overwritten by merge:git

        application/config/config.php服務器

        application/controllers/home.phpapp

Please, commit your changes or stash them before you can merge.spa

Aborting開發

但服務器上的代碼並無更新過,不可能有代碼上的衝突。it

最後搜索結果得知,是由於git配置文件config裏面的:filemode = true 形成的。io

filemode 默認值是true,表示強制檢測文件mode,把它改成false,表示不檢測文件filemode,git pull 成功。配置

臨時修改:git config core.filemode falsefile

全局修改:git config --global core.filemode false

是由於在win上開發後,文件權限改變了,在服務器上更新,git強制比較,就會形成這種結果。

相關文章
相關標籤/搜索