4

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 git@github.com: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 git@github.com: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
  • What does ˋtype gitˋ return? What happens if you run ˋmkdir ~/gitclone && cd ~/gitclone && git clone NAMEOFREMOTEREPˋ? – nohillside Feb 28 at 6:31
  • @nohillside I added the output you asked. Nothing out of the ordinary I'd say for git command. Seems like the problem is not related to a particular folder either, it's system-wide. – Vadorequest Feb 28 at 12:26
6
+50

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.

  • Indeed! That was the reason :) Thank you! Can't grant the bounty yet due to SO policy but you got it Jon, it's working again – Vadorequest Feb 28 at 12:35
  • And I don't even know what this config remote "origin" was supposed to do, I had it because a coworker was using it, years ago and I kept it because why not. Maybe a good practice with the old git binary, would love to know what it's for though and if I should replace it by something else ;) – Vadorequest Feb 28 at 12:39
  • I'm not quite sure either. Here's some documentation on refspec. Perhaps someone smarter than us can provide further insight :) – Jon Leopard Feb 28 at 12:52
  • Seems like it was meant to fetch the tags by default when running git fetch without having to manually do git fetch --tags, see stackoverflow.com/questions/16678072/… – Vadorequest Feb 28 at 12:59
  • 1
    Another more in-depth link, very explanatory: stackoverflow.com/questions/1204190/… – Vadorequest Feb 28 at 13:00
1

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.

  • Hum, I don't think it's related to the issue at all. The command git clone git@github.com:UnlyEd/serverless-plugin-dynamodb-backups.git which doesn't specify a directory will create one by default. And it's totally possible to clone a git repo from inside another git repo :) – Vadorequest Feb 28 at 12:22
  • You are correct on both. My doubt is that a parent git repo has some error that is causing this problem. Anyways, these are not the issue that you are having. – valkjsaaa Mar 1 at 3:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .