1

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

Alex
  • 7,538
  • 23
  • 84
  • 152
  • Let's dive under the hood a bit to try and figure this out. Can you post the contents of `.git/config` which is where the information about your remotes is stored. – Peter Lundgren Jun 16 '13 at 14:28
  • I think there was a minor bug where the last config section was not deleted if empty, which may be your issue. Have a look at the config file (it's plain text) and see if you still have a [remote "origin"] section (as Peter L said). It may also be because of its use as a default. – Philip Oakley Jun 16 '13 at 16:47
  • That's the weird part, no origin nor upstream is defined – Alex Jun 17 '13 at 05:50
  • Then check the output of `git config --global -l` and `git config --system -l` just in case – VonC Jun 17 '13 at 06:00
  • `git config --global -l` returns `user.name` and `user.email` while `git config --system -l` at the end, returns `remote.origin.fetch` and `remote.upstream.fetch` – Alex Jun 17 '13 at 06:17
  • @VonC no update on the matter? – Alex Jun 18 '13 at 21:05
  • @w0rldart sorry, I missed your previous comment. I can assure you a system git config file should *never* include any `remote.origin` information. Can you do a `git config --system --edit` and manually remove the `[remote]` section? And see if that improves the situation? Note: I would still recommend that for the global config (`git config --global --edit`) in your specific case, just to clean up the remote `origin`. I will see the result in a few hours: time to go to bed for me. – VonC Jun 18 '13 at 22:11
  • @VonC Could it be related to Github client on Windows? I mean, I haven't done that manually, neither executing any command, so the only thing remaining is Github. What do you think? – Alex Jun 18 '13 at 22:18

1 Answers1

2

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.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250