Reputation: 151
I'm using the latest version of Git available for the latest version of Cygwin. About half the time when pulling from some remote, I get the following error:
fatal: Error in line 1:
A full trace produces the following:
$ GIT_TRACE=2 git pull -v upstream master
trace: exec: 'git-pull' '-v' 'upstream' 'master'
trace: run_command: 'git-pull' '-v' 'upstream' 'master'
trace: built-in: git 'rev-parse' '--git-dir'
trace: built-in: git 'rev-parse' '--is-bare-repository'
trace: built-in: git 'rev-parse' '--show-toplevel'
trace: built-in: git 'ls-files' '-u'
trace: built-in: git 'symbolic-ref' '-q' 'HEAD'
trace: built-in: git 'config' '--bool' 'branch.master.rebase'
trace: built-in: git 'config' '--bool' 'pull.rebase'
trace: built-in: git 'rev-parse' '-q' '--verify' 'HEAD'
trace: built-in: git 'fetch' '-v' '--update-head-ok' 'upstream' 'master'
trace: run_command: 'ssh' '[email protected]' 'git-upload-pack '\''Project/project.git'\'''
trace: run_command: 'rev-list' '--verify-objects' '--stdin' '--not' '--all' '--quiet'
trace: run_command: 'rev-list' '--verify-objects' '--stdin' '--not' '--all'
trace: exec: 'git' 'rev-list' '--verify-objects' '--stdin' '--not' '--all'
trace: built-in: git 'rev-list' '--verify-objects' '--stdin' '--not' '--all'
From redacted.com:Project/project
* branch master -> FETCH_HEAD
trace: built-in: git 'rev-parse' '-q' '--verify' 'HEAD'
trace: built-in: git 'fmt-merge-msg'
fatal: Error in line 1:
Has anyone run into this problem? And if so, how did you fix it?
Upvotes: 4
Views: 598
Reputation: 139431
I have also observed this problem on Cygwin 1.7.9 on Windows 7. Somehow .git/FETCH_HEAD
becomes corrupt. This happens with remotes that fetch via SSH and also on the same host.
For a workaround, consider an excerpt from the git pull
documentation:
In its default mode,
git pull
is shorthand forgit fetch
followed bygit merge FETCH_HEAD
.
To avoid having to read FETCH_HEAD
, name your branch explicitly. For example, assuming you’re on master
and tracking origin/master
, execute the following sequence to get the same effect as git pull
.
$ git fetch $ git merge origin/master
I thought this problem was sporadic, but I’m having trouble to get it to succeed at all lately.
#! /usr/bin/env perl
use strict;
use warnings;
sub usage {
<<EOUsage;
Usage: $0 [how-many]
where how-many is a positive integer (default: 100)
EOUsage
}
$0 =~ s!^.*/!!;
my $howmany = @ARGV ? shift : 100;
die usage if @ARGV || $howmany !~ /^ (?!0+$) \d+$/x;
my $bad;
for (1 .. $howmany) {
unlink ".git/FETCH_HEAD";
my $output = `git fetch -v 2>&1`;
die "$0: git fetch exited ", ($? >> 8), ":\n", $output if $?;
++$bad unless system("git rev-parse -q --verify FETCH_HEAD") == 0;
}
my $pct = sprintf "%d%%", ($bad/$howmany) * 100;
print "$0: fetches=$howmany, bad=$bad ($pct)\n";
Upvotes: 1