Golang编程语言知识介绍


  • 首页

  • todo

  • 思考

  • life

  • food

  • OS

  • lua

  • redis

  • Golang

  • C

  • TCP/IP

  • ebpf

  • p4

  • OpenVPN

  • IPSec

  • L2TP

  • DNS

  • distributed

  • web

  • OpenWRT

  • 运维

  • Git

  • 鸟哥的私房菜

  • IT杂谈

  • 投资

  • About Me

  • 友情链接

  • FTP

  • 搜索
close

Git远程仓库地址变更本地如何修改

时间: 2021-12-13   |   分类: 运维   git     |   阅读: 491 字 ~1分钟

公司搬移, 作为git仓库的服务器IP地址变了。 本地代码挺多,重新检出太占时间,可以修改一个什么配置让我本地仓库和新的远程仓库建立关联吗, 答案是肯定的!

方法有很多,这里简单介绍几种:

以下均以项目git_test为例: 老地址:http://192.168.1.12:9797/john/git_test.git 新地址:http://192.168.100.235:9797/john/git_test.git 远程仓库名称: origin

方法一 通过命令直接修改远程地址

  1. 进入git_test根目录
  2. git remote 查看所有远程仓库, git remote xxx 查看指定远程仓库地址
  3. git remote set-url origin http://192.168.100.235:9797/john/git_test.git

方法二 通过命令先删除再添加远程仓库

  1. 进入git_test根目录
  2. git remote 查看所有远程仓库, git remote xxx 查看指定远程仓库地址
  3. git remote rm origin
  4. git remote add origin http://192.168.100.235:9797/john/git_test.git

方法三 直接修改配置文件

  1. 进入git_test/.git

  2. vim config [core]repositoryformatversion = 0filemode = truelogallrefupdates = trueprecomposeunicode = true[remote "origin"]url = http://192.168.100.235:9797/shimanqiang/assistant.gitfetch = +refs/heads/*:refs/remotes/origin/*[branch "master"]remote = originmerge = refs/heads/master

    修改 [remote “origin”]下面的url即可

方法四 通过第三方git客户端修改。

以SourceTree为例,点击 仓库 -> 仓库配置 -> 远程仓库 即可管理此项目中配置的所有远程仓库, 而且这个界面最下方还可以点击编辑配置文件,同样可以完成方法三。

#运维# #git#
git查看文件的历史提交信息
git忽略文件权限和所有者
shankusu2017@gmail.com

shankusu2017@gmail.com

日志
分类
标签
GitHub
© 2009 - 2025
粤ICP备2021068940号-1 粤公网安备44011302003059
0%