Git clone fails with "fatal: multiple updates for ref 'refs/tags/v1.0.0' not allowed" on MacOS Mojave
I did a lot of operations on my computer last night, basically updating/upgrading(?) brew, which installed a new git version, updated python, lots of stuff and today I figured I couldn't clone a repository anymore.
git clone [email protected]:UnlyEd/serverless-plugin-dynamodb-backups.git
Cloning into 'serverless-plugin-dynamodb-backups'...
remote: Enumerating objects: 589, done.
remote: Total 589 (delta 0), reused 0 (delta 0), pack-reused 589
Receiving objects: 100% (589/589), 304.18 KiB | 862.00 KiB/s, done.
Resolving deltas: 100% (333/333), done.
fatal: multiple updates for ref 'refs/tags/v1.0.0' not allowed
I tried different repo, I get the same error every time, so it's my installation that is broken somehow.
I tried uninstalling/reinstalling git (with brew) but it didn't change anything.
I checked other git commands and I'm still able to pull/commit
I'm using git 2.21.0
I don't really know what to do to fix it and I don't know what caused this. Also, I don't use the git clone command on a daily basis so it could have broken before, but I feel like it's related to upgrading homebrew.
Adding more details based on comments/questions:
type git
git is an alias for LANG=en_GB git
mkdir ~/gitclone && cd ~/gitclone && git clone [email protected]:UnlyEd/serverless-plugin-dynamodb-backups.git
Cloning into 'serverless-plugin-dynamodb-backups'...
remote: Enumerating objects: 589, done.
remote: Total 589 (delta 0), reused 0 (delta 0), pack-reused 589
Receiving objects: 100% (589/589), 304.18 KiB | 828.00 KiB/s, done.
Resolving deltas: 100% (333/333), done.
fatal: multiple updates for ref 'refs/tags/v1.0.0' not allowed
Do you have a custom .gitconfig? I had to remove the following parameter from mine in order for cloning to work again:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
git v2.21.0
was released a few days ago, so perhaps something changed under the hood. I need to go check out the release notes.
Anyways, hope this helps!
Adding a bit more background context, this line was very common to fetch the tags by default. It allowed to do git fetch
which would also do a git fetch --tags
equivalent under the hood.
Basically, if you want to fetch tags when you do a git fetch
with this v2.21 git version, you can create an alias in your .gitconfig
as follow:
[alias]
fetch = git fetch --tags
Doing this and removing the fetch = +refs/heads/*:refs/remotes/origin/*
will result in the same behaviour, but compatible with git v2.21
See https://stackoverflow.com/questions/1204190/does-git-fetch-tags-include-git-fetch/20608181#20608181 for in-depth explanation and history changes.
I'm not sure if this is the issue here, but have you checked if the folder that you are trying to clone into is empty? Also check if the folder you are trying to cloning into is already managed by another git repository.
You can check if it's a git repository by doing git status
and see it should be fatal: not a git repository (or any of the parent directories): .git
.