Git远程仓库地址变更,3种更新本地远程地址的方法
接上一篇文章 http://istester.com/git/527.html
三种方法 ,
方法一:
更换本地git库 远程仓库地址 详细过程
isTester.com@MacBook-Pro-4 isTester % git remote -v
origin http://t.istester.com:3000/21DayisTester/LinuxBlog.git (fetch)
origin http://t.istester.com:3000/21DayisTester/LinuxBlog.git (push)
isTester.com@MacBook-Pro-4 isTester %
isTester.com@MacBook-Pro-4 isTester % git remote set-url origin http://t.istester.com:3000/21DayisTester/LinuxBlog.git
isTester.com@MacBook-Pro-4 isTester % git remote -v
origin http://t.istester.com:3000/21DayisTester/LinuxBlog.git (fetch)
origin http://t.istester.com:3000/21DayisTester/LinuxBlog.git (push)
isTester.com@MacBook-Pro-4 isTester %
isTester.com@MacBook-Pro-4 isTester % git push
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 272 bytes | 272.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To http://t.istester.com:3000/21DayisTester/LinuxBlog.git
8e5a7bc..0657828 master -> master
方法二:
先通过命令删除旧远程仓库,再添加新的远程仓库;
istester.com@MacBook-Pro-4 istester % git remote rm origin
istester.com@MacBook-Pro-4 istester % git remote -v
istester.com@MacBook-Pro-4 istester % git remote add orgin http://t.istester.com:3000/21DayisTester/LinuxBlog.git
istester.com@MacBook-Pro-4 istester % git remote -v
orgin http://t.istester.com:3000/21DayisTester/LinuxBlog.git (fetch)
orgin http://t.istester.com:3000/21DayisTester/LinuxBlog.git (push)
istester.com@MacBook-Pro-4 istester %
方法三:
直接修改 .git 配置文件
vim .git/config
找到配置文件里的 地址
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "orgin"]
url = **http://t.istester.com:3000/21DayisTester/LinuxBlog.git** # 修改这个地址
fetch = +refs/heads/*:refs/remotes/orgin/*