下载远程仓库,修改为自己的内部的git库,通过git remote set-url命令非常方便,先add内部的git地址,然后再delete原来的,然后push到内部git库,这样就成了。
git remote set-url --add origin git@git.xx.com:gstreamer/orc.git
git remote set-url --delete origin git@gitlab.freedesktop.org:gstreamer/orc.git
git config --list --show-origin 可以查看git仓库的详细配置,如果前面的delete命令不生效,直接修改.git/config也是可以的:
$ git config --list --show-origin
file:/home/hui/.gitconfig http.proxy=
file:/home/hui/.gitconfig alias.st=status
file:/home/hui/.gitconfig core.editor=vim
file:/home/hui/.gitconfig color.ui=auto
file:/home/hui/.gitconfig cola.spellcheck=false
file:/home/hui/.gitconfig user.name=xxx
file:/home/hui/.gitconfig user.email=xx@xx.com
file:/home/hui/.gitconfig mergetool.keepbackup=false
file:.git/config core.repositoryformatversion=0
file:.git/config core.filemode=true
file:.git/config core.bare=false
file:.git/config core.logallrefupdates=true
file:.git/config remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
file:.git/config remote.origin.url=git@git.xx.com:gstreamer/orc.git
file:.git/config branch.master.remote=origin
file:.git/config branch.master.merge=refs/heads/master
如果要保留更多tag信息,也要将其他tag push到服务器上。
push tag通过命令:
git push --tags
还可以反着用,切换回原始git url,然后pull代码也是可以的:
git remote set-url --add origin git@gitlab.freedesktop.org:gstreamer/orc.git
git remote set-url --delete origin git@git.xx.com:gstreamer/orc.git
git pull
|