Blackjack
Blackjack

Reputation: 1065

git remote tracking branch return "requested upstream branch does not exist"

I've git config like this:

[remote "origin"]
   url = [email protected]:archie/learn-express.git
   fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
   remote = origin     <==== 
   merge = refs/heads/master
[remote "znotanto"]
   url = https://[email protected]/znotanto/learn-express.git
   fetch = +refs/heads/*:refs/remotes/znotanto/*

I wanna change the part that I show with arrow to znotanto. I've tried git branch master --set-upstream-to znotanto/master from so but give me error

error: the requested upstream branch 'znotanto/master' does not exist

Upvotes: 1

Views: 1604

Answers (1)

torek
torek

Reputation: 490078

Does the repository copy over at znotanto (https://[email protected]/znotanto/learn-express.git) actually have a branch named master yet?

If so, use:

git fetch znotano

to get your Git to learn about it. This will have your Git create your remote-tracking name znotanto/master, after which you will be able to set znotanto/master as the upstream of any of your branches.

If not, you need to first create the name master in the Git repository at znotanto, so that your Git will see it so that your Git will create your remote-tracking name znotanto/master. So in this case, first create that branch there—exactly how is not important—and then run git fetch znotanto.

Upvotes: 1

Related Questions