20

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

Inazense
  • 1,177
  • 2
  • 13
  • 22

5 Answers5

90

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.

Mark Leong
  • 1,428
  • 11
  • 13
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.

torek
  • 330,127
  • 43
  • 437
  • 552
  • 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 properly – Inazense Nov 18 '19 at 20:14
  • 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. – torek Nov 18 '19 at 21:06
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

muetzenflo
  • 4,344
  • 3
  • 27
  • 65
  • 2
    I'm afraid that is not fixing yet. I tested with that version and newer ones and it is continue appearing sometimes.. – Inazense Apr 22 '20 at 07:55
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.

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.

MarianP
  • 2,577
  • 16
  • 17