admin管理员组

文章数量:1316323

How is the following output possible? git remote is still showing 'origin', after it has been removed:

$ git remote -v
origin

$ git remote remove origin
error: No such remote: 'origin'

I can add another 'origin', and remove it, but it is still listed afterward:

$ git remote add origin ../  # some arbitrary path

$ git remote -v
origin  ../ (fetch)
origin  ../ (push)

$ git remote remove origin

$ git remote -v
origin

The .git/config file is

[core]
        repositoryformatversion = 0
        filemode = false
        bare = false
        logallrefupdates = true
        symlinks = false
        ignorecase = true
  • This repo was created by cloning a local repo, and then removing 'origin'.
  • I am on Windows (git version 2.46.0.windows.1).

EDIT

As Michele De Falco guessed, I have something in my config:

$ git config --global --list | grep origin
remote.origin.prune=true

After removing it, the output of git remote -v is empty, as expected.

How is the following output possible? git remote is still showing 'origin', after it has been removed:

$ git remote -v
origin

$ git remote remove origin
error: No such remote: 'origin'

I can add another 'origin', and remove it, but it is still listed afterward:

$ git remote add origin ../  # some arbitrary path

$ git remote -v
origin  ../ (fetch)
origin  ../ (push)

$ git remote remove origin

$ git remote -v
origin

The .git/config file is

[core]
        repositoryformatversion = 0
        filemode = false
        bare = false
        logallrefupdates = true
        symlinks = false
        ignorecase = true
  • This repo was created by cloning a local repo, and then removing 'origin'.
  • I am on Windows (git version 2.46.0.windows.1).

EDIT

As Michele De Falco guessed, I have something in my config:

$ git config --global --list | grep origin
remote.origin.prune=true

After removing it, the output of git remote -v is empty, as expected.

Share Improve this question edited Jan 29 at 16:32 Guildenstern 3,8882 gold badges28 silver badges53 bronze badges asked Jan 29 at 10:20 kniaknia 7498 silver badges18 bronze badges 1
  • 1 Run git config --global --list and git config --system --list, if origin is there then run git config --global --unset remote.origin.url – Michele De Falco Commented Jan 29 at 10:37
Add a comment  | 

1 Answer 1

Reset to default 4

Run git config --global --list and git config --system --list, if origin is there then run git config --global --unset remote.origin.url

本文标签: git remote lists 39origin39 after removalStack Overflow