git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: aborted 'git fetch' leaves workspace unusable

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 30, 2013, 19:37 UTC
Message-ID
<xmqq8uv2ruyy.fsf@gitster.dls.corp.google.com>
In-Reply-To
<7adcf8024c435b9b7178b86f01e447bb@stephe-leake.org>
stephen_leake@stephe-leake.org writes:
Show 6 quoted lines
> 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.

Show 5 quoted lines
> - '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")?

Previous: stephen_leake@stephe-leake.orgNext: Torsten Bögershausen
Message 2 of 3 in “aborted 'git fetch' leaves workspace unusable”
  1. stephen_leake@stephe-leake.orgDec 30, 2013
  2. Junio C HamanoDec 30, 2013
  3. Torsten BögershausenDec 30, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.