Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fatal: could not unset 'branch.master.remote'

Tags:

git

bitbucket

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/*
like image 300
abhimanyuaryan Avatar asked Jan 10 '17 11:01

abhimanyuaryan


People also ask

Can't push to remote branch Cannot be resolved to branch?

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.

What is git branch -- unset upstream?

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.

How do I push a new branch to a remote?

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.


1 Answers

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.

like image 98
VonC Avatar answered Oct 07 '22 05:10

VonC