1

I'm working on remote repository with git commands on windows cmd and it works well, but when working with git commands in git bash terminal I get error:

Your configuration specifies to merge with the ref 'refs/heads/feature/branch-name'
from the remote, but no such ref was fetched.

How can I fix it for git bash terminal?

Sakén
  • 197
  • 1
  • 12
  • As a sidenote, `feature/` is part of the `branch-name`. – Romain Valeri Oct 08 '21 at 07:12
  • Yes, when I work on some tasks I create a new branch to work on this task, in this case it's branch-name, and after finishing the task I make pull request to the main branch – Sakén Oct 08 '21 at 08:32

2 Answers2

2

Check first, in your git bash session, the ouput of:

git branch -avv
git status

Make sure the name of the branch you are in matches the remote one, especially considering the case (uper/lowercase), in case it is insensitive in a CMD session, and sensitive in a bash session.
See this example.

If the list of branches show the local one is not linked to a remote tracking one, then, as I documented in "[Difference between git checkout --track origin/branch and git checkout -b branch origin/branch][2]":

git branch -u origin/branch branch
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • For the first command it prints the list of available branches and for the second command it prints: ```On branch next Your branch is up to date with 'origin/next'. nothing to commit, working tree clean``` – Sakén Oct 08 '21 at 08:26
  • @Sakén can you edit your question with the exact output of the list of branches from the first command? – VonC Oct 08 '21 at 09:42
1

It started working when I moved to the main branch (next). But, when i switch back to my branch this is what I get:

$ git pull
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=origin/<branch> feature/branch-name

Finally found the answer here: Why do I have to "git push --set-upstream origin <branch>"?

git push -u origin <your-local-branch-name>

So if your local branch name is coffee

git push -u origin coffee
Sakén
  • 197
  • 1
  • 12