3

I have something weird since we started using sub modules for git. I'm on Windows 10 and use either Tortoise git or Powershell or cmd or the Linux command interpreter.

Whenever I try to pull a sub module, I get something like this:

PS
D:\repositories\git\ProjectAlice\ProjectAliceSkills\PublishedSkills\AliceCore>
git pull error: cannot lock ref 'refs/tags/1.0.35>=1.0.0-a4': Unable
to create
'D:/repositories/git/ProjectAlice/ProjectAliceSkills/.git/modules/PublishedSkills/skill_AliceCore/refs/tags/1.0.35>=1.0.0-a4.lock':
Invalid argument From
https://github.com/project-alice-assistant/skill_AliceCore  ! [new
tag]         1.0.35>=1.0.0-a4 -> 1.0.35>=1.0.0-a4  (unable to update
local ref) error: cannot lock ref 'refs/tags/1.0.36>=1.0.0-a5': Unable
to create
'D:/repositories/git/ProjectAlice/ProjectAliceSkills/.git/modules/PublishedSkills/skill_AliceCore/refs/tags/1.0.36>=1.0.0-a5.lock':
Invalid argument  ! [new tag]         1.0.36>=1.0.0-a5 ->
1.0.36>=1.0.0-a5  (unable to update local ref) error: cannot lock ref 'refs/tags/1.0.37>=1.0.0-a5': Unable to create
'D:/repositories/git/ProjectAlice/ProjectAliceSkills/.git/modules/PublishedSkills/skill_AliceCore/refs/tags/1.0.37>=1.0.0-a5.lock':
Invalid argument  ! [new tag]         1.0.37>=1.0.0-a5 ->
1.0.37>=1.0.0-a5  (unable to update local ref) error: cannot lock ref 'refs/tags/1.0.38>=1.0.0-a5': Unable to create
'D:/repositories/git/ProjectAlice/ProjectAliceSkills/.git/modules/PublishedSkills/skill_AliceCore/refs/tags/1.0.38>=1.0.0-a5.lock':
Invalid argument  ! [new tag]         1.0.38>=1.0.0-a5 ->
1.0.38>=1.0.0-a5  (unable to update local ref) error: cannot lock ref 'refs/tags/1.0.39>=1.0.0-a5': Unable to create
'D:/repositories/git/ProjectAlice/ProjectAliceSkills/.git/modules/PublishedSkills/skill_AliceCore/refs/tags/1.0.39>=1.0.0-a5.lock':
Invalid argument  ! [new tag]         1.0.39>=1.0.0-a5 ->
1.0.39>=1.0.0-a5  (unable to update local ref) error: cannot lock ref 'refs/tags/1.0.40>=1.0.0-a5': Unable to create
'D:/repositories/git/ProjectAlice/ProjectAliceSkills/.git/modules/PublishedSkills/skill_AliceCore/refs/tags/1.0.40>=1.0.0-a5.lock':
Invalid argument  ! [new tag]         1.0.40>=1.0.0-a5 ->
1.0.40>=1.0.0-a5  (unable to update local ref) error: cannot lock ref 'refs/tags/1.0.42>=1.0.0-a5': Unable to create
'D:/repositories/git/ProjectAlice/ProjectAliceSkills/.git/modules/PublishedSkills/skill_AliceCore/refs/tags/1.0.42>=1.0.0-a5.lock':
Invalid argument  ! [new tag]         1.0.42>=1.0.0-a5 ->
1.0.42>=1.0.0-a5  (unable to update local ref) PS D:\repositories\git\ProjectAlice\ProjectAliceSkills\PublishedSkills\AliceCore>
git pull error: cannot lock ref 'refs/tags/1.0.35>=1.0.0-a4': Unable
to create
'D:/repositories/git/ProjectAlice/ProjectAliceSkills/.git/modules/PublishedSkills/skill_AliceCore/refs/tags/1.0.35>=1.0.0-a4.lock':
Invalid argument From
https://github.com/project-alice-assistant/skill_AliceCore  ! [new
tag]         1.0.35>=1.0.0-a4 -> 1.0.35>=1.0.0-a4  (unable to update
local ref) error: cannot lock ref 'refs/tags/1.0.36>=1.0.0-a5': Unable
to create
'D:/repositories/git/ProjectAlice/ProjectAliceSkills/.git/modules/PublishedSkills/skill_AliceCore/refs/tags/1.0.36>=1.0.0-a5.lock':
Invalid argument  ! [new tag]         1.0.36>=1.0.0-a5 ->
1.0.36>=1.0.0-a5  (unable to update local ref) error: cannot lock ref 'refs/tags/1.0.37>=1.0.0-a5': Unable to create
'D:/repositories/git/ProjectAlice/ProjectAliceSkills/.git/modules/PublishedSkills/skill_AliceCore/refs/tags/1.0.37>=1.0.0-a5.lock':
Invalid argument  ! [new tag]         1.0.37>=1.0.0-a5 ->
1.0.37>=1.0.0-a5  (unable to update local ref) error: cannot lock ref 'refs/tags/1.0.38>=1.0.0-a5': Unable to create
'D:/repositories/git/ProjectAlice/ProjectAliceSkills/.git/modules/PublishedSkills/skill_AliceCore/refs/tags/1.0.38>=1.0.0-a5.lock':
Invalid argument  ! [new tag]         1.0.38>=1.0.0-a5 ->
1.0.38>=1.0.0-a5  (unable to update local ref) error: cannot lock ref 'refs/tags/1.0.39>=1.0.0-a5': Unable to create
'D:/repositories/git/ProjectAlice/ProjectAliceSkills/.git/modules/PublishedSkills/skill_AliceCore/refs/tags/1.0.39>=1.0.0-a5.lock':
Invalid argument  ! [new tag]         1.0.39>=1.0.0-a5 ->
1.0.39>=1.0.0-a5  (unable to update local ref) error: cannot lock ref 'refs/tags/1.0.40>=1.0.0-a5': Unable to create
'D:/repositories/git/ProjectAlice/ProjectAliceSkills/.git/modules/PublishedSkills/skill_AliceCore/refs/tags/1.0.40>=1.0.0-a5.lock':
Invalid argument  ! [new tag]         1.0.40>=1.0.0-a5 ->
1.0.40>=1.0.0-a5  (unable to update local ref) error: cannot lock ref 'refs/tags/1.0.42>=1.0.0-a5': Unable to create
'D:/repositories/git/ProjectAlice/ProjectAliceSkills/.git/modules/PublishedSkills/skill_AliceCore/refs/tags/1.0.42>=1.0.0-a5.lock':
Invalid argument  ! [new tag]         1.0.42>=1.0.0-a5 ->
1.0.42>=1.0.0-a5  (unable to update local ref)

So, something to do with locked references. The annoying bit is that when I do the same git pull through the Linux command interpreter, well, it just works...... Where Tortoise git, cmd or Powershell fails with the mentioned error.

I did update git today to be sure, I did try all the prune suggestions I found on that problem, nothing solves it. Well, use the Linux Command Interpreter then they say! Well, unfortunately, there's a ton of sub modules....

michael_heath
  • 5,262
  • 2
  • 12
  • 22
Psychokiller1888
  • 620
  • 2
  • 10
  • 25

1 Answers1

7

The problem is likely the names of the tags here:

 ! [new tag] 1.0.35>=1.0.0-a4 -> 1.0.35>=1.0.0-a4

This shows you that, on their computer (no doubt running Linux), they have a Git tag named 1.0.35>=1.0.0-a4. Your Git, running on your computer, decided to create a tag with the same name. (That's the basic idea behind tags: that, unlike branch names, everyone should share the same names. So if they make a tag X in their Git, your Git will copy that tag, and its stored hash ID, to your Git, also calling it X. Compare this to branch names: if they make a branch named X, your Git will rename this and call it origin/X.)

To do so, your Git is attempting to create local file system files with this string as part of the file's name. Your computer refuses to do that for some reason—probably rejecting the > character. See Bret Cameron's answer to What characters are forbidden in Windows and Linux directory names?

One solution to this is to tell your Git not to attempt to copy their tags at all: add --no-tags to your git fetch or git pull command. A better one is to get your colleagues / co-workers to stop using such characters in any names.

torek
  • 448,244
  • 59
  • 642
  • 775
  • Yep, you were correct, thank you so much for bringing it to my attention! I've rewritten all tags on every submodules with a little script – Psychokiller1888 Feb 03 '20 at 14:49
  • What if it happens with a new branch? I'm getting `! [new branch] user/con -> origin/user/con (unable to update local ref)` because `con` is not allowed as a filename on Windows. Any flags to overcome this? – Shlomo Gottlieb Oct 25 '21 at 09:27
  • 1
    @ShlomoGottlieb: no: just change the branch name. (There's no need to use the same branch name in any two repositories, except for human preferences / sanity. In this case Windows forces insanity.) Since they have the `con` name and you can't make the `origin/user/con` name at all, you'll have to `git fetch origin user/con:refs/remotes/origin/user-con` or something like that, which will be a pain in the butt, but will work. – torek Oct 25 '21 at 16:37
  • 1
    To restore sanity, ask them to change their branch name. In the meantime, consider making this a single-branch clone or otherwise futzing with the default fetch refspecs. – torek Oct 25 '21 at 16:40