公司搬迁后,作为git仓库的服务器的IP地址发生了变化。 本地代码太多,重新签出需要太长时间。 可以修改任何配置以将本地仓库与新的远程仓库相关联吗? 答案是肯定的!
方法有很多,这里简单介绍几个。 以下全部以项目git_test为例。
旧地址: http://192.168.1.12:9797/John/git _ test.git
新地址: http://192.168.100.23533609797/John/git _ test.git
远程仓库名称: origin
如果使用方法命令直接更改远程地址以访问git_test根目录git remote,则、 将显示所有远程仓库git remote xxx指定的远程仓库地址gitremoteset-URL origin http://192.168.100.23533609797/John/使用git_test.git方法2命令删除,然后添加远程仓库进入git_test根目录git remote以显示所有远程仓库。 git remote xxx是指定的远程仓库地址gitremotermorigingitremoteaddorigin 3358192.168.100.23533609797/John/git _ test.
[酷睿]
repositoryformatversion=0
filemode=true
logallrefupdates=true
precomposeunicode=true
[远程' origin ' ]
URL=http://192.168.100.23533609797/shimanqiang/assistant.git
fetch=refs/heads/* : refs/remotes/origin/*
[branch 'master']
remote=origin
merge=refs/heads/master
修改[ remote“origin”]下的url即可
方法4在第三方git客户端上进行修复。 以SourceTree为例,单击“仓库-仓库配置-远程仓库”可以管理此项目中配置的所有远程仓库。 也可以通过单击此界面底部的“编辑配置式”来完成方法3。