Git 切换远程仓库地址

在我们的项目版本管理,可能会改变远程仓库地址的情况,那么如何修改本地项目的远程仓库地址呢

origin 是默认的远程版本库名称

查看远程地址

1
2
3
$ git remote show origin
remote: Repository Not Found
fatal: repository 'https://gitee.com/******/xxxx.git/' not found

因为远程仓库地址已被修改,所以本地查看时候提示没有被发现

修改远程地址

1
$ git remote set-url origin https://gitee.com/******/xxxx.git/

查看确认修改成功

1
2
3
4
5
6
7
8
9
10
11
$ git remote show origin
* remote origin
Fetch URL: https://gitee.com/****/xxxx.git/
Push URL: https://gitee.com/****/xxxx.git/
HEAD branch: master
Remote branch:
master tracked
Local branch configured for 'git pull':
master merges with remote master
Local ref configured for 'git push':
master pushes to master (up to date)
坚持原创技术分享,您的支持将鼓励我继续创作!
0%