Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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...

like image 825
Inazense Avatar asked Nov 18 '19 16:11

Inazense


3 Answers

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.

like image 111
Mark Leong Avatar answered Nov 10 '22 10:11

Mark Leong


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.

like image 2
torek Avatar answered Nov 10 '22 08:11

torek


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

like image 2
muetzenflo Avatar answered Nov 10 '22 08:11

muetzenflo