# aborted 'git fetch' leaves workspace unusable

3 messages from 2013-12-30 to 2013-12-30. Participants: stephen_leake@stephe-leake.org, Junio C Hamano, Torsten Bögershausen.
Thread: https://gitlist.dev/t/35587

## stephen_leake@stephe-leake.org, 2013-12-30 17:07

Subject: aborted 'git fetch' leaves workspace unusable
Message-ID: <7adcf8024c435b9b7178b86f01e447bb@stephe-leake.org>
URL: https://gitlist.dev/e/7adcf8024c435b9b7178b86f01e447bb%40stephe-leake.org

```
I forgot to do 'ssh-add', so a 'git fetch' running under Windows Emacs
tried to prompt for the ssh passphrase, could not find an ssh 
passphrase
prompt program, and aborted.

That left the workspace unusable:

- .git/FETCH_HEAD is empty

     that causes 'git rev-parse FETCH_HEAD' to fail with a confusing
     error message.

- 'git fetch' just hangs after outputting:

remote: Counting objects: 15, done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 9 (delta 5), reused 0 (delta 0)

     even with -v --progress

A fresh clone allowed me to continue working, but this will happen
again, so I'd like a better fix.

The fetch is from stephen_leake@git.savannah.gnu.org/emacs/elpa.git

I'm running git 1.7.9 from Cygwin. I have access to Debian, where I can
compile git and run it under the debugger, if that helps. I have not 
yet
tried to reproduce this bug on Debian.

--
-- Stephe

```

## Junio C Hamano, 2013-12-30 19:37

Subject: Re: aborted 'git fetch' leaves workspace unusable
Message-ID: <xmqq8uv2ruyy.fsf@gitster.dls.corp.google.com>
URL: https://gitlist.dev/e/xmqq8uv2ruyy.fsf%40gitster.dls.corp.google.com
In-Reply-To: <7adcf8024c435b9b7178b86f01e447bb@stephe-leake.org>

```
stephen_leake@stephe-leake.org writes:

> That left the workspace unusable:
>
> - .git/FETCH_HEAD is empty
>
>     that causes 'git rev-parse FETCH_HEAD' to fail with a confusing
>     error message.

This is not limited to your Cygwin environment.  I can see that we
leave an empty file there after a failed fetch with

	$ git fetch ssh://no.such.place/

But I would not call it leaving "the workspace unusable".  If you
ask "git rev-parse" "What is in FETCH_HEAD?", you would get "that is
not even a revision", which is what you would get.

Similar operations that try to use FETCH_HEAD as if there is a valid
revision, e.g. "git merge FETCH_HEAD", would also not work, which is
very much expected.  I wouldn't think that needs something drastic
as "this workspace is unusable, let's start from a new clone".

If it really bothers you, you can always safely do

	$ rm -f .git/FETCH_HEAD

but of course, after that, nothing that tries to use FETCH_HEAD as
if there is a valid revision, e.g. "git show FETCH_HEAD", would not
work until you fetch from somewhere, so there isn't that much to be
gained by doing so.

> - 'git fetch' just hangs after outputting:
>
> remote: Counting objects: 15, done.
> remote: Compressing objects: 100% (8/8), done.
> remote: Total 9 (delta 5), reused 0 (delta 0)

This looks more serious, but I suspect it is totally unrelated to
your previous fetch failing and leaving FETCH_HEAD there.  Is this
"'git fetch' hangs" reproduce in a clean clone _without_ first
encountering the failure (due to the forgotton "ssh-add")?

```

## Torsten Bögershausen, 2013-12-30 19:54

Subject: Re: aborted 'git fetch' leaves workspace unusable
Message-ID: <52C1CF7E.9000603@web.de>
URL: https://gitlist.dev/e/52C1CF7E.9000603%40web.de
In-Reply-To: <7adcf8024c435b9b7178b86f01e447bb@stephe-leake.org>

```
On 2013-12-30 18.07, stephen_leake@stephe-leake.org wrote:
> I forgot to do 'ssh-add', so a 'git fetch' running under Windows Emacs
Windows native emacs or emacs under cygwin ?
> tried to prompt for the ssh passphrase, could not find an ssh passphrase
> prompt program, and aborted.
> 
> That left the workspace unusable:
> 
> - .git/FETCH_HEAD is empty
> 
>     that causes 'git rev-parse FETCH_HEAD' to fail with a confusing
>     error message.
Would you mind to post the "confusion error message" here?
Because some people may find it useful.
> 
> - 'git fetch' just hangs after outputting:
> 
> remote: Counting objects: 15, done.
> remote: Compressing objects: 100% (8/8), done.
> remote: Total 9 (delta 5), reused 0 (delta 0)
> 
>     even with -v --progress
> 
> A fresh clone allowed me to continue working, but this will happen
> again, so I'd like a better fix.
> 
> The fetch is from stephen_leake@git.savannah.gnu.org/emacs/elpa.git
> 
> I'm running git 1.7.9 from Cygwin. 
This feels old, we have v1.8.5.2 as the latest version.

I have access to Debian, where I can
> compile git and run it under the debugger, if that helps. I have not yet
> tried to reproduce this bug on Debian.
This could be helpful:
a) compile git under cygwin (try 1.8.5.2), and see if the problem is still there.
b) Which version of cygwin do you have? 
c) If the same problem exist under Debian, debugging it could be helpfull, yes.
  If the same problem exist here, in some version of git, it would be helpful to test
  the latest version of git. (Which means compile & debug)
HTH
/Torsten

```
