Question

I have executed git remote rm origin and I still get the following result.

this

Executing git branch -r returns no result, and when executing git remote rm origin again, I get

Could not remove config section 'remote.origin'

I have also executed a git gc --purge=now and no result for the above issue. Any idea what could go wrong, and how to fix it?

.git/config contents

[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
    hideDotFiles = dotGitOnly
[branch "master"]
[gitflow "branch"]
    master = master
    develop = develop
[gitflow "prefix"]
    feature = feature/
    release = release/
    hotfix = hotfix/
    support = support/
    versiontag = 

That's the weird part, no origin nor upstream is defined

Was it helpful?

Solution

Executing git branch -r returns no result

So there isn't any remote tracking branch fetched from any upstream remote repo.
But that has no bearing on the number of remote repo declared for your local repo: you could have 100 remotes repos declared, as long as no git fetch is done, a git branch -r would still return nothing.

and when executing git remote rm origin again, I get

Could not remove config section 'remote.origin'

That is the standard message for saying that the remote you are trying to (again) delete doesn't exist.
The first git remote rm origin did work.

At this point, all what remains would be a remote named 'origin ' (with a space at the end).
Or, as Peter Lundgren and Philip Oakley mention in the comments, an empty extra entry in the .git/config file, named "origin", that you might need to manually delete.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top