dublev dublev - 1 year ago 94
Git Question

Suddenly unable to git fetch from origin

In my repository, I remotely track our main repository, which is bare. I've never had any problems with fetching from origin the past.

However, when I tried to remote update this morning, I got the following error:

fatal: '/users/integrator/project' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
error: Could not fetch origin

I haven't changed anything, and the repository is definitely still there. There are several people who have access to the integrator account, but they generally do merges and pulls. We don't allow pushing to this repository.

My question is: what could have caused this to happen? Or, are there any diagnostics I can use to figure out what is going wrong? I am not the only user suddenly having this problem, so the problem is more likely on the side of origin.


When I try to clone the bare repository, I get the following error:

git clone /users/integrator/project
Cloning into project...
fatal: failed to open '/users/integrator/project/.git/objects': No such file or directory

Here's a list of the contents of /users/integrator/project:

[lots of folders with two character long names]

Answer Source

I would take a look at what is in the /users/integrator/project directory on your server. Does it look like a git repository? It needs to have at leas an objects directory, refs directory, and HEAD file in order to be a proper git repository. Does it contain all of those?

Another thing to check is if you can log in directly to the server, and clone from the repository.

Beyond that, if you still can't figure out what's wrong, I'd recommend editing your question to show a listing of what's in /users/integrator/project, and perhaps we can provide more help with that information.

edit based on your edit:

Given the error, it looks like you might have a .git directory within your bare repository. You can check with ls -a, to show hidden files as well. If this is the case, Git may be looking into the .git directory within your repository first, instead of looking at your repository directory itself. I would take a look for that, and then move the inner .git away or delete it to allow Git to access your actual repository.

If there isn't a .git directory within your repo, look around for anything named .git or project.git in the vicinity too; Git will search a variety of path names based on the one you give it, and a bare path name without a .git subdirectory or suffix is near the end of what it searches.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download