I am trying to remove git remote. I have just removed heroku remote url with the command
$ git remote rm heroku
but when I try to use this on remote for bitbucket(origin). It fails with an error
git remote rm origin
fatal: could not unset 'branch.master.remote'
where's when listing remote with
$ git remote -v
clearly mentions
origin [email protected]:username/myapp.git (fetch)
origin [email protected]:username/myapp.git (push)
.git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[branch "master"]
[branch "static-pages"]
[remote "origin"]
url = [email protected]:myUserName/mY_Hidden_App.git
fetch = +refs/heads/*:refs/remotes/origin/*
The cause in my case was that the correct branch name was in uppercase, but the branch name specified in the push command was in lowercase. The above command will tell you the correct branch name, so push it. Show activity on this post. I checked out from Feature/name to feature/name and it resolved my issue.
To summarize, --unset-upstream only deletes a link locally, without erasing any data. You can then re-connect at any time: git branch master --set-upstream-to=origin/master.
Push a new Git branch to a remote repo Clone the remote Git repo locally. Create a new branch with the branch, switch or checkout commands. Perform a git push with the –set-upstream option to set the remote repo for the new branch. Continue to perform Git commits locally on the new branch.
This error message (fatal: could not unset
) should not appear anymore with Git 2.12.2 or more (March 2017)
See commit 20690b2 (18 Feb 2017) by Ross Lagerwall (rosslagerwall
).
(Merged by Junio C Hamano -- gitster
-- in commit 3e5c639, 27 Feb 2017)
"git remote rm X
", when a branch has remote X
configured as the value of its branch.*.remote
, tried to remove branch.*.remote
and branch.*.merge
and failed if either is unset.
Make sure the [branch "master"]
line is gone from your local config, and again, with the latest Git 2.12.2 released yesterday, this won't happen again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With