- 問題:Filename too long in git for windows
我用Mac端的SourceTree提交了一個Ionic ngCordova 插件,安卓同事用Windows端SourceTree拉取時失敗,提示File name too long
解決方法:
網(wǎng)上說的用系統(tǒng)管理員身份打開cmd,輸入運行git config --system core.longpaths true并沒有解決問題,可能是因為SourceTree客戶端使用的是內(nèi)置git,而不是系統(tǒng)git,切換成系統(tǒng)git問題更多,可能跟配置有關(guān)系吧。
最終解決辦法是打開Git Bash(開始,輸入git,第一個估計就是),輸入命令git config --system core.longpaths true,運行。網(wǎng)上90%都是這個樣子說的,但還是沒解決問題,然后看到有一個博客上說用git config --global core.longpaths true
在git bash中,運行下列命令:
git config --global core.longpaths true就可以解決該問題。
--global是該參數(shù)的使用范圍,如果只想對本版本庫設(shè)置該參數(shù),只要在上述命令中去掉--global即可。
順利解決問題。
Tips:可以直接使用SourceTree自帶的命令行模式工具,前提是勾選了默認使用Git Bash作為命令行工具。
附上其他答案:
-
Solution1 - set global config, by running this command:
git config --system core.longpaths true - or you can edit directly your specific git config file like below:
YourRepoFolder -> .git -> config:
[core]
repositoryformatversion = 0
filemode = false
...
longpaths = true <-- (add this line under core section)