Git: “not a valid name” when adding local repo as remote repo

I have this situation:

I have two repositories on my machine, both are based on the same original repository.

  • Github remote Branch and Local Git Repo
  • GIT How can I track empty folder with its permission
  • plink Password Over and Over
  • Git : using .gitignore with different branches
  • Is it a good practice to make a tag in git for every deployment build?
  • How to git stash pop specific stash in 1.8.3?
  • But the other one has a branch I would like to copy to the other (I created it on that other repo and did lots of changes). Reason for this is that the second repo is in the Eclipse workspace and includes my “current” work.

    I have tried creating a remote repo:

    [remote "other"]
    fetch = +refs/heads/*:refs/remotes/other/*
    url = /home/me/src/other
    

    It shows up with git remote:

    $:~/src/prod$ git remote
    other
    origin
    

    But if I try to access that branch with e.g.

    git branch --track other_branch other/branch
    

    I get

    fatal: Not a valid object name: 'other/branch'.
    

    That branch does exist, I have verified with “git branch”.

    So what’s wrong?

    I also tried adding this to .git/config with

    [branch "branch"]
    remote = other
    merge = refs/heads/other_branch
    

    But the branch won’t show up with “git branch -r”.

  • When is necessary and sufficient for the second run of `git merge` stop reporting any conflict?
  • Prevent git from asking for the GnuPG password during signing a commit
  • merge git projects without common commit
  • Git continues to push a .c9 folder despite it being in .gitignore
  • Add comments/remarks to .gitattributes
  • Duplicate Tag on Remote
  • One Solution collect form web for “Git: “not a valid name” when adding local repo as remote repo”

    If you haven’t contacted the remote repository git doesn’t know about other/branch branch, so it complains about it. Just fetch the repository state with

    git fetch other
    
    Git Baby is a git and github fan, let's start git clone.