You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

移除origin后git remote仍显示?Windows下Git异常问题排查

Git移除origin远程仓库后仍显示'origin'的问题排查与解决

问题现象

移除origin远程仓库后,执行git remote -v仍显示'origin',尝试删除时提示无此远程仓库:

$ git remote -v
origin

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

重新添加origin后再移除,问题依旧:

$ git remote add origin ../  # 任意路径

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

$ git remote remove origin

$ git remote -v
origin

查看当前仓库的.git/config文件,已无origin相关配置:

[core]
        repositoryformatversion = 0
        filemode = false
        bare = false
        logallrefupdates = true
        symlinks = false
        ignorecase = true

背景信息

  • 仓库由克隆本地仓库后移除origin创建
  • 运行环境:Windows,Git版本2.46.0.windows.1

问题原因与解决

原因

全局Git配置中存在remote.origin.prune=true配置项,Git识别到该全局配置后,错误判定存在origin远程仓库。

解决步骤

  1. 检查全局配置中的origin相关项:
$ git config --global --list | grep origin
remote.origin.prune=true
  1. 移除该全局配置项:
git config --global --unset remote.origin.prune

执行后再次运行git remote -v,输出为空,问题解决。

内容的提问来源于stack exchange,提问作者knia

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.14 16:08:16