此问题,请不要使用 rebase, 下载最新的 TortoiseGit 即可;

  TortoiseGit-2.3中文版与Git安装包_手册: http://download.csdn.net/detail/renfufei/9738152

问题描述

  昨天,以及今天(2014-11-29),使用 TortoiseGit 时碰到了一个诡异的问题. 卸载,清理注册表,重装,重启,各种折腾以后,还是不能解决. 但是23.45分一过,突然灵光一闪,解决了.

问题是这样的. 使用命令行的 git pushgit fetchgit pull 什么的都没问题. 但是使用 TortoiseGit 执行拉取(pull ...) 命令时, 就给报错, 报错信息如下:

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 的哪里配置不对.

  想去想来,突然想在 局部仓库的配置文件中修改下, 先看看会报错的这种配置:

[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拉取操作会有哪些日志输出呢?

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 @ 2014/11/30 0:11:27)

  一对比就发现第一行 git pull ..... 最后面少了一个 master. 于是想着在 config 文件里面加上这个 master 看看行不行.

  修改后的配置如下:

[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 变为:

    [branch "master"]
remote = origin master
merge = refs/heads/master

  如下图所示:

  

  保存,再次测试,OK,可以正常拉取:

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 @ 2014/11/30 0:19:25)

  注意看到, 在第一行 git.exe pull .... 最后面多出了一个 master:

  

  好了,问题完美解决.[这可能是 TortoiseGit 当前版本的一个 BUG]

总结

  有些日子,不适合写代码,也不适合调程序, 但适合填坑, 也许坑填的多了,时间一转,问题就解决了。

补充说明

  问题应该是特定版本的Git与TortoiseGit不兼容导致的。我使用的版本信息是:

TortoiseGit 1.8.12.0 (D:\Develop\TortoiseGit\bin\)
git version 1.9.4.msysgit.2 (D:\Develop\Git\bin)

  这个就会出问题。好像跟分支多少没关系。

  我的办公室电脑的Git版本好像是 1.9.2 还是什么,反正不是1.9.4,就没有问题,也不需要特殊处理。

  具体的软件,你可以到这里下载:

  http://download.csdn.net/detail/renfufei/9738152

--------------------- 作者:铁锚 来源:CSDN 原文:https://blog.csdn.net/renfufei/article/details/41648061?utm_source=copy 版权声明:本文为博主原创文章,转载请附上博文链接!

(转)解决 TortoiseGit 诡异的 Bad file number 问题的更多相关文章

  1. 解决 TortoiseGit 诡异的 Bad file number 问题

    http://blog.csdn.net/renfufei/article/details/41648061 问题描述 昨天,以及今天(2014-11-29),使用 TortoiseGit 时碰到了一 ...

  2. 解决 TortoiseGit 诡异的 Bad file number 问题(转)

    问题描述 昨天,以及今天(2014-11-29),使用 TortoiseGit 时碰到了一个诡异的问题. 卸载,清理注册表,重装,重启,各种折腾以后,还是不能解决. 但是23.45分一过,突然灵光一闪 ...

  3. GitHub上传不了的解决 ssh: connect to host github.com port 22: Bad file number git did not exit cleanly (exit code 128)

    问题情况 本来一直用的是github的客户端,结果现在上传的时候出问题了,去网站上看,新项目已经创建,但是代码却怎么都上传不上去.于是只好用命令行的方式解决. Tortoisegit上是这样说的: g ...

  4. OGG-01224 Bad file number

    今天在看OGG的日志时.发现例如以下OGG-01224 Bad file number错误.查阅资料才知道port不可用,看了一下mgr的參数,发现是设置的DYNAMICPORTLIST 动态port ...

  5. 解决 dpkg: warning: files list file for package 'x' missing 问题

    参考: dpkg: warning: files list file for package 'x' missing 解决 dpkg: warning: files list file for pac ...

  6. 解决 Github:failed to add file / to index 问题

    参考: Github:failed to add file / to index 解决 Github:failed to add file / to index 问题 在通过Github for Ma ...

  7. 解决 Error: ENOSPC: System limit for number of file watchers reached

    manjaro 18.0 kde版本 运行 yarn test报错 Error: ENOSPC: System limit for number of file watchers reached 解决 ...

  8. 解决clang: error: no such file or directory: such file or directory:的问题

    一,详细问题描述 clang: error: no such file or directory: 'xxx/src/GGBaCollectionViewCell.m' clang: error: n ...

  9. SQLite 解决:Could not load file or assembly 'System.Data.SQLite ... 试图加载格式不正确的程序/or one of its dependencies. 找不到指定的模块。

     Could not load file or assembly 'System.Data.SQLite.dll' or one of its dependencies. 找不到指定的模块. 错误提示 ...

随机推荐

  1. struct,map,json 互相转换

    1.1 struct to json 准备 很简单,使用encoding包可以互相转换,没什么好说的,但是有几点注意: 1.结构体内需要序列化的字段首字母大写(遵循驼峰式命名),不需要序列化的字段小写 ...

  2. [swarthmore cs75] Compiler 6 – Fer-de-lance

    课程回顾 Swarthmore学院16年开的编译系统课,总共10次大作业.本随笔记录了相关的课堂笔记以及第8次大作业. First-class function: It treats function ...

  3. Centos7配置hadoop伪分布式

    修改hostname(可选) 通过下面命令查看hostname信息 hostnamectl 通过下面命令修改hostname hostnamectl set-hostname gy01 如图所示 下面 ...

  4. p112 the podocyte

    正常人尿液只有一很少的蛋白质.尿蛋白特别是白蛋白的出现,是肾小球疾病的重要特征,也是众多肾脏疾病的关键的诊断标记,包括了统计数据或者说经济效应上都很重要的那些肾病.糖尿病肾病等等.可能没被广泛认识的是 ...

  5. STM32的SWD调试进不了main函数

    玩了那么久STM32,还没有用SWD调试过程序(一直都是用printf调试程序),觉得有些落后了,于是开始搞起了SWD调试. 很快通过查阅资料,知道了keil里面的配置和ST-Link与STM32的连 ...

  6. 行业相关的webgl项目

    炼钢厂污水处理http://www.hightopo.com/demo/CirculatingWaterPump/index.html智能idc机房http://www.hightopo.com/de ...

  7. 【python-appium】appium 关键字

    Appium 服务关键字 关键字 描述 实例 automationName 你想使用的自动化测试引擎 Appium (默认) 或 Selendroid platformName 你要测试的手机操作系统 ...

  8. C++面试基础概念之动态库篇

    编写DLL所学所思(1)——导出函数 编写DLL所学所思(2)——导出类 C++ DLL导出类 知识大全 C++类库开发详解

  9. nohup和&后台运行,进程查看及终止

    1.nohup 用途:不挂断地运行命令. 语法:nohup Command [ Arg … ] [ & ] 无论是否将 nohup 命令的输出重定向到终端,输出都将附加到当前目录的 nohup ...

  10. JAVA RSA加密AES加密

    RSA加密: import sun.misc.BASE64Decoder; import sun.misc.BASE64Encoder; import javax.crypto.Cipher; imp ...