有时候,我们用着用着git,运维突然说要迁移git地址。我们开发人员也是只能配合。
那这时候有什么办法解决呢?
据目前自己的了解,有如下几种办法。
一、修改命令
git remote set-url origin URL
其中URL,这是自己的git服务器地址,比如我的git地址IP为:127.0.0.1
则执行如下命令:
git remote set-url origin http://用户名:密码@127.0.0.1/demo.git
二、修改config文件
1、找到你的项目根目录中的.git文件夹
2、.git文件夹里有一个config文件
3、用记事本打开后,修改为服务器的新ip就行了。
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
[remote "origin"]
url = http://用户名:密码@127.0.0.1/demo.git
fetch = +refs/heads/*:refs/remotes/origin/*