funny refname error when creating a new remote branch

10,520

Solution 1

In the Target Ref Name, probably you have to add refs/heads:

refs/heads/name_of_your_new_branch

In your specific case:

refs/heads/workingBranch

(at least, it is the way with Bitbucket - egit, the Eclipse plugin for Eclipse)

Solution 2

I find it a litle bit silly that EGit expects something like V0.0.1 when you create a Tag (placing the tag to /refs/tags/V0.0.1 location in the local repository) and it expects to provide the refname like /refs/tags/V0.0.1 when you push the Tag into the remote repository

Share:
10,520

Related videos on Youtube

Scuba Steve
Author by

Scuba Steve

Updated on October 14, 2022

Comments

  • Scuba Steve
    Scuba Steve over 1 year

    So I've gotten a project up on github and everything is dandy. Now I want to create a new branch.

    Here's what I've done:

    1. created a new local branch
    2. pushed the new branch to github

    Here's the problem: During the push to my remote, I get this error:

    Repository ssh://[email protected]/<username>/ProjectColossus.git
    
    funny refname
    error: refusing to create funny ref 'workingBranch' remotely
    

    My remote repo is called origin, so I've tried using that refname as suggested in another answer here on stackoverflow, but I get the same error. I've also tried using the same name as my new local branch, in the "Target Ref Name:" field before the remote push, but I really just am not sure what I'm doing at this point. I know there's something I'm not getting about git remote pushes, so a little explanation would be super helpful. I'm pretty new to git and version control, but I'm an intermediate level programmer (starting second year CS in January).

    • John Szakmeister
      John Szakmeister over 11 years
      @ScubaSteve The Pro Git book can be useful here. It describes how refs work, and the Git User's Manual talks about them too. Basically, all refs do is point at a commit. Branches are under refs/heads, tags are under refs/tags, and remotes go under refs/remotes. So refs/heads/workingBranch refers to a branch.
    • the.malkolm
      the.malkolm
      Please provide the exact command you tried.
    • John Szakmeister
      John Szakmeister
      I've never used egit, but I suspect that it's this code returning the error. And given that the branch name looks fine, it's probably because it's not being push to refs/heads. If there's an option about where to push, you could try refs/heads/workingBranch.
    • Scuba Steve
      Scuba Steve
      @jszakmeister Yeah that's what I ended up doing.. I'm not sure what refs/heads/ means, but I prefixed it to the new branch name and it worked.
  • Scuba Steve
    Scuba Steve almost 11 years
    forgot about this question.. but yup.. pretty much how i solved it
  • Scuba Steve
    Scuba Steve over 5 years
    My experience with EGit is that it's quite fussy. Hell, all of Eclipse is fussy. I'm a .Net dev now, and it's a world of difference.