git - 为什么我的 git repo 有两个别名?
问题描述
从我在其他问题上看到的情况来看,“来源”是您的存储库的别名,这样您就不必输入整个 url,对吗?如果是这样,为什么我还有另一个名为“github”的别名,两者都允许我获取和推送。有没有办法删除“github”?
me$ git remote -v
github https://github.com/me/app.git (fetch)
github https://github.com/me/app.git (push)
origin https://github.com/me/app.git (fetch)
origin https://github.com/me/app.git (push)
这里发生了什么?我试图删除“github”,但这不起作用。
git config --global --unset alias.github
解决方案
那不是别名,而是远程。两者都是技术术语(行话):Git 别名是[alias]
配置部分中的一个,您git config --global --unset
将删除它,但远程是一个部分中的名称(因此可以保存多个设置 - 通常这里有两个,一个用于URL 和一个作为默认值)。[remote "name"]
fetch
有没有办法删除“github”?
运行git remote remove github
。1
1您也可以使用git config
删除整个部分,但与远程一起,您可能会有一些远程跟踪名称集,并且git remote remove
会清理所有内容,而不仅仅是配置文件中的条目。
推荐阅读
- cmd - 从 Windows cmder 获取带有“调用”的 cmd 文件
- php - Preg Match Subpatterns - 如何匹配字符串后面的所有 TD
- r - R如何同时将我的结果导出到多个栅格图层中?
- javascript - Java Weblauncher - JNLP 问题
- javascript - 从 API 获取数据并显示为名称和网站链接
- swift - 发生错误时向用户显示有意义消息的最常见格式是什么 - Swift
- c++ - 从 CMake 导出的 CodeLite 项目无法编译
- c# - .net core BackgroundService Http Server/GRPC - 停止方法?
- google-app-engine - 如何将现有的 docker 镜像推送到谷歌应用引擎
- laravel - laravel 在不应用强制转换的情况下获取数据