由于公司的Git服务机器搬迁,导致域名变动,所以不得不更改当前已有的项目的远程仓库地址。
- 首先使用git命令
git remote -v
来查看当前仓库的远程地址
image.png
大家顺便也看下
git remote
和git remote -v
的区别:一个是显示大概的,一个是显示详细内容(verbose)
- 切换地址:三种方法,根据自己的实际情况来选择
- 直接设置url
```git
git remote set-url origin https://xxx.xx.com/xxx/xxx.git
```

- 先删后加
```git
git remote rm origin
git remote add origin https://xxx.xx.com/xxx/xxx.git
```
- 直接修改config文件
如果你的项目已经加入版本控制,那可以到项目根目录下,查看隐藏文件夹, 发现.git文件夹,找到其中的config文件,就可以修改其中的git remote origin地址了。

网友评论