解决 TortoiseGit 诡异的 Bad file number 问题
2015-04-25 10:27
357 查看
问题描述
昨天,以及今天(2015-4-25),使用 TortoiseGit 时碰到了一个诡异的问题. 卸载,清理注册表,重装,重启,各种折腾以后,还是不能解决. 但是11.24一过,突然灵光一闪,解决了.问题是这样的. 使用命令行的
git push,
git fetch,
git pull什么的都没问题. 但是使用 TortoiseGit 执行拉取(pull ...) 命令时, 就给报错, 报错信息如下:
[plain] view plaincopy
git.exe pull -v --no-rebase --progress "origin"
/libexec/git-core/git-sh-setup: line 83: /bin/sed: Bad file number
From https://github.com/cncounter/translation
= [up to date] master -> origin/master
D:\Develop\Git/libexec/git-core\git-pull: line 268: /bin/tr: Bad file number
Your configuration specifies to merge with the ref 'master'
from the remote, but no such ref was fetched.
git 未能顺利结束 (退出码 1) (3510 ms @ 2014/11/29 23:51:56)
死活各种折腾,根据提示,说: 你的配置指定了去合并(merge)远端的'master',但没有获取(fetch)到这个引用(ref).
然后各种测试,各种折腾,总算发现了一点规律. 如果 GitHub 在线仓库只有一个分支, 也就是 master 时, Pull 拉取就不报错, 如果在线的远端仓库有多个分支,如
master加上
gh-pages时,一拉取就报这个错. 但使用 git 命令行就没有这个问题. 那么问题来了, 肯定是 TortoiseGit 的哪里配置不对.
想去想来,突然想在 局部仓库的配置文件中修改下, 先看看会报错的这种配置:
[plain] view plaincopy
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
hideDotFiles = dotGitOnly
[remote "origin"]
url = https://github.com/cncounter/translation.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[remote]
pushdefault = origin
[credential]
helper = store
查看方法:
打开Git项目根目录, 找到 .git 文件夹,进去里面编辑config这个文件,注意此文件没有后缀.
还可以在项目根目录下点击鼠标右键, 选择 TortoiseGit --> Settings(设置 S), 然后选择左边的 Git --> 右边的 编辑本地.git/config 按钮,即可打开这个文件,如下图所示:
那么,看看一个正常的pull拉取操作会有哪些日志输出呢?
[plain] view plaincopy
git.exe pull -v --no-rebase --progress "origin" master
From https://github.com/renfufei/asynquence
* branch master -> FETCH_HEAD
= [up to date] master -> origin/master
Already up-to-date.
成功 (5959 ms @ 2015/04/25 0:11:27)
一对比就发现第一行 git pull ..... 最后面少了一个 master. 于是想着在 config 文件里面加上这个 master 看看行不行.
修改后的配置如下:
[plain] view plaincopy
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
hideDotFiles = dotGitOnly
[remote "origin"]
url = https://github.com/cncounter/translation.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin master
merge = refs/heads/master
[remote]
pushdefault = origin
[credential]
helper = store
需要注意的是,因为远端有多个分支,所以这个配置文件里,相应的就多了一个小节
[branch "master"],而 这个小节下面的 remote = origion, 现在加上 master 变为:
[plain] view plaincopy
[branch "master"]
remote = origin master
merge = refs/heads/master
如下图所示:
保存,再次测试,OK,可以正常拉取:
[plain] view plaincopy
git.exe pull -v --no-rebase --progress "origin" master
From https://github.com/cncounter/translation
* branch master -> FETCH_HEAD
= [up to date] master -> origin/master
Already up-to-date.
成功 (2246 ms @ 2015/04/25 10:30:25)
注意看到, 在第一行 git.exe pull .... 最后面多出了一个 master:
好了,问题完美解决.[这可能是 TortoiseGit 当前版本的一个 BUG]
相关文章推荐
- 解决 TortoiseGit 诡异的 Bad file number 问题
- 解决 TortoiseGit 诡异的 Bad file number 问题
- 解决 TortoiseGit 诡异的 Bad file number 问题
- 解决 TortoiseGit 诡异的 Bad file number 问题
- 解决 TortoiseGit 诡异的 Bad file number 问题(转)
- 解决 TortoiseGit 诡异的 Bad file number 问题
- 解决 TortoiseGit 诡异的 Bad file number 问题
- 解决 TortoiseGit 诡异的 Bad file number
- Eclipse中编译和运行时使用的JDK和JRE级别问题(关于"Bad version number in .class file"的异常解决)
- Bad version number in .class file的问题解决办法总结
- 解决运行jar文件 Bad version number in .class file 报错问题
- Bad version number in .class file这个问题的解决方法
- Bad version number in .class file问题解决
- Bad version number in .class file 问题解决
- 解决java.lang.UnsupportedClassVersionError: Bad version number in .class file问题
- 出现java.lang.UnsupportedClassVersionError: Bad version number in .class file问题的解决方法分析
- java.lang.UnsupportedClassVersionError: Bad version number in .class file 问题解决办法.
- Bad version number in .class file (unable to load class ***)错误解决
- bad version number in .class file的问题小结
- tomcat bad version number in class file 的解决方法