Sankar Subburaj
Sankar Subburaj

Reputation: 5042

Not able to clone a git repo

While clone a git repo I am facing the below fatal error.

fatal: cannot process 'refs/remotes/origin/rr' and 'refs/remotes/origin/rr/ee' at the same time

This rep is hosted in AWS and I am using this repo for more then a year. Last 2 days I am not able to clone this.

Upvotes: 1

Views: 1890

Answers (1)

bk2204
bk2204

Reputation: 76904

There are two ways for Git to write a reference onto disk: as a file in the file system, and as an entry in the packed-refs file.

When you write a reference into the file system, you can't have both refs/remotes/origin/r2 (because that would be a file) and refs/remotes/origin/r2/qe (because that would make r2 a directory). Obviously, r2 cannot be both a file and a directory at the same time, so Git fails.

If the server has both of these references, they're probably in the packed-refs file, which is used to refer to references whose objects are all packed. This is more efficient than storing large numbers of unchanged references in the file system, so Git updates this file when it packs the repository. It also doesn't suffer from the file-directory problem that's mentioned above, although it's not possible to use this file in all cases.

If you're just trying to do a fetch and not a full clone, you probably want to do a git fetch --prune origin first to remove the branch that isn't on the server.

If you're explicitly trying to clone both branches, you need to skip specifying both, because it won't be possible. If you're having this problem with a repository, it's probably best to notify the person maintaining that repository and ask them to delete one of those references, since it will cause problems for anyone who tries to clone.

If you can't do that, you can clone with git clone --single-branch -b master origin to clone only the master branch (or whichever branch you like) of your origin remote, and then pull in other branches as you need them with git fetch.

Upvotes: 5

Related Questions