Cygwin and Git: getting "fatal: error on line 1:"

I am using the latest version of Git for the latest version of Cygwin. In about half the cases when you are pulling from some remote control, I get the following error:

fatal: error on line 1:

A full trace creates 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' ' git@redacted.com ' '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 encountered this problem? And if so, how did you fix it?

+4
source share
1 answer

I also observed this problem on Cygwin 1.7.9 on Windows 7. Somehow .git/FETCH_HEAD becomes corrupt. This happens with remotes that are retrieved via SSH, as well as on the same host.

For a workaround, consider an excerpt from the git pull documentation :

In default mode, git pull is short for git fetch , followed by git merge FETCH_HEAD .

To avoid reading FETCH_HEAD , explicitly indicate your branch. For example, assuming you are reusing master and tracking origin/master , run 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 had problems in order to succeed 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"; 
+1
source

Source: https://habr.com/ru/post/1400050/


All Articles