Error pushing changes on GIT. Ref names must follow git ref-format rules
Asked Answered
C

5

24

I have one error using git on Sourcetree. I've created a local branch called sprints/Mycompany_sprint_1 (because I want it in a category) and then I did multiple cherry picks to this branch from another one. After that, I tried to push all the changes on my branch, but I am receiving next error:

The Remote branch '' (Local branch = 'sprints/Mycompany_sprint-1') is invalid. Ref names must follow git ref-format rules: https://www.kernel.org/pub/software/scm/git/docs/git-check-ref-format.html Completed with errors, see above.

But if I go to the link, I am following (as far I saw) all the rules, because looking at the first rule:

They can include slash / for hierarchical (directory) grouping, but no slash-separated component can begin with a dot . or end with the sequence .lock.

I check if the problem could be that the spring category already exists, but is not the case.
Can anyone tell me what I am doing wrong, please? I'm affraid that cannot see the error here...

Cogitable answered 18/11, 2019 at 16:22 Comment(0)
P
99

This seems to be a bug affecting SourceTree for Windows version 3.3.4: https://jira.atlassian.com/browse/SRCTREEWIN-12593

A workaround until the bug is fixed is to untick and retick the branch checkbox in the push dialog.

Plumy answered 11/12, 2019 at 3:30 Comment(1)
Note that sometimes SourceTree is not updating automagically, like happened to me and others, so I had to download and reinstall from Bitbucket Site Ref SRCTREEWIN-12593De
F
2

The problem is not with your local branch name. The problem is with the branch name you asked the other Git to use.

Here's that error message again, this time in fixed-width font for clarity:

The Remote branch '' (Local branch = 'sprints/Mycompany_sprint-1') is invalid.

Remove the parenthetical remark, which is merely informational:

The Remote branch '' is invalid.

You have—somehow; this should be impossible—specified a remote branch name that is completely empty. That's not a valid branch name. How you specified it, I have no idea, but you need to stop doing that.

Fogged answered 18/11, 2019 at 18:53 Comment(2)
Dammit, I didn't understand it at first. Thanks for your answer. The thing is that I am not defining an empty name, I am using the same... not sure about the failure. Anyway, I pushed through console and it works properlyCogitable
Yeah, the command line won't let you supply an empty destination name without at least working at it. This sounds like a GUI bug.Fogged
A
2

As per 22nd of November 2019 this finally seems to be fixed.

SourceTree 3.3.6 [22 November 2019]
  Changes
    Fixed new branches in the push dialog not setting the remote branch name
    Fixed the create patch screen allowing split view

Source: SourceTree Release Notes

Ankeny answered 21/4, 2020 at 20:34 Comment(1)
I'm afraid that is not fixing yet. I tested with that version and newer ones and it is continue appearing sometimes..Cogitable
A
0

I was Pushing Release_Staging_2.0 to orgin I was getting same error..When I renamed it to Staging_2.0 in my local branch ,it worked..Still didnt find exact reason but u can try.

Aloha answered 9/1, 2020 at 9:27 Comment(0)
I
0

I got this error in SourceTree when trying to push a detached HEAD (from a tag) to a different repository. It was not any name format validation error.

The solution was create a local branch from the HEAD and push it to the different repo.

Iwo answered 14/7, 2020 at 14:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.