10

Git fetch and pull both stopped working yesterday on the server (AWS instance).

$ git fetch
ERROR: Repository not found.
fatal: The remote end hung up unexpectedly

There are two repository clones on that instance, both giving the same error. git still works well from local PCs.

git remote -v gives the same results on local PC and on the server; ssh git@github.com works as it should ("Hi (name)! You've successfully authenticated, but GitHub does not provide shell access.")

There's one difference in behaviour: git pull origin st+[Tab] used to expand to a branch name; now it expands to a name of the file in current directory (filename is not the same as branch name).

UPDATE: I tried re-creating remote: SSH version still fails, but HTTP worked.

According to this discussion in git mailing list, this is actually a problem on GitHub site.

UPDATE

output with GIT_TRACE=1

############# Local results #############

$ GIT_TRACE=1 git fetch
setup: git_dir: .git
setup: worktree: c:/Projects/(local_path)
setup: cwd: c:/Projects/(local_path)
setup: prefix: (null)
trace: built-in: git 'fetch'
trace: run_command: 'ssh' 'git@github.com' 'git-upload-pack '\''(username)/(reponame).git'\'''
Enter passphrase for key '(keyname)':
trace: run_command: 'rev-list' '--quiet' '--objects' '--stdin' '--not' '--all'


############# AWS results #############

$ GIT_TRACE=1 git fetch
trace: built-in: git 'fetch'
trace: run_command: 'ssh' 'git@github.com' 'git-upload-pack '\''(username)/(reponame).git'\'''
ERROR: Repository not found.
fatal: The remote end hung up unexpectedly
CharlesB
  • 86,532
  • 28
  • 194
  • 218
egor83
  • 1,199
  • 1
  • 13
  • 26
  • what is the output of `git remote -v`? – Alexander Bird May 03 '12 at 19:35
  • `origin git@github.com:(username)/(reponame).git (fetch)` `origin git@github.com:(username)/(reponame).git (push)` I've double checked and saw that `git remote -v` on my local Win install didn't have `.git` on the end. Tried changing it on server - doesn't work with or without `.git`. Changed it on local PC - works fine in both cases. – egor83 May 03 '12 at 20:07
  • 1
    Can you try explicitly specifying `git fetch origin` as well? – djs May 03 '12 at 20:21
  • Just tried, same result: `ERROR: Repository not found.` `fatal: The remote end hung up unexpectedly` – egor83 May 03 '12 at 20:27
  • Did you try cloning from your repository to another place? Just to make sure the repo is really there. – vhallac May 03 '12 at 20:49
  • Fetch, pull and push work alright from local PCs, so I'm sure github repo is in place and functional. – egor83 May 03 '12 at 20:51
  • 3
    One reported problem with this was a leftover windows `CR` in the `.git/config` file at the end of the `url = git@github.com:....` line. Can you check? – vhallac May 03 '12 at 21:03
  • There were no visible characters. Deleted everything on the end until the next line merged, then added a new line; same result. – egor83 May 03 '12 at 21:26
  • 2
    Try with exporting the `GIT_TRACE=1` in the environment first, like `$ GIT_TRACE=1 git push ...` -- do you see anything of interest in the output? – kostix May 03 '12 at 22:28
  • Yes, there's something coming up... http://pastecode.com/bd3fc1a79f8e9d1eaf30911d9895938051c472f4 So repo address is exactly the same, but the whole setup section is missing. What might have caused it? – egor83 May 03 '12 at 22:58
  • 1
    @egor83, no immediate idea at the moment, but try researching [these results](http://www.google.com/search?q=git+worktree+site%3Astackoverflow.com) -- especially the first one. P.S. Please refer (using `@`) to the person whose comment you're answering, otherwise \[s\]he won't get notified of your reply. – kostix May 03 '12 at 23:30
  • @kostix, thanks for advice! Will try these out. – egor83 May 03 '12 at 23:44
  • @kostix it appears worktree is only used/set manually in some special cases. Furthermore, I ran `$ GIT_TRACE=1 git fetch` on my other server, and it worked there while producing the same starting trace without setup section. – egor83 May 05 '12 at 23:34
  • Discussion cross-posted on git mailing list with answers: http://git.661346.n2.nabble.com/Git-fetch-pull-stopped-working-td7537181.html – CharlesB May 09 '12 at 19:16
  • Confirm that you can even SSH in to github from your AWS instance – Thomas Dignan May 09 '12 at 19:53
  • @CharlesB, I linked it in my update: they helped me figure out that the problem is on GH side, but it's not fixed yet anyway. Working with GH support now. – egor83 May 10 '12 at 22:23
  • @TomDignan: `ssh git@github.com` works as expected - "you've authenticated, but Github doesn't provide shell access". Or did you have in mind some other way of confirming that? – egor83 May 10 '12 at 22:24

1 Answers1

7

Problem solved.

Turns out that was a miscommunication on our side: the guy who setup the keys on that box left, and his access to GH repo has been revoked.

GitHub returns "repo not found" rather than "you have no access rights for this repository" - their support said they didn't want to leak the existence of a repo unless you have access rights to it.

egor83
  • 1,199
  • 1
  • 13
  • 26
  • 2
    Your not the only one the fall into that trap :). Not sure why they have implemented 404 for no access. – Abe Petrillo May 14 '12 at 19:31
  • " their support said they didn't want to leak the existence of a repo unless you have access rights to it." I don't buy that. They also give the same useless error message when you do have access, but your password is no longer cached locally and you also get that message when you only have read-only access. In both cases you clearly already know about the existence of the repo. – Kaiserludi May 29 '17 at 18:47