是否可以在GitHub、SourceForge和Google Code上进行git仓库镜像(在所有主机之间同步),考虑到它们都支持git?
是否可以在GitHub、SourceForge和Google Code上进行git仓库镜像(在所有主机之间同步),考虑到它们都支持git?
你可以编辑.git/config
文件,创建一个远程仓库,使其能够推送到多个存储库。
[remote "everyone"]
url = https://github.com/USERNAME/REPOSITORY.git
url = ssh://USERNAME@git.code.sf.net/p/PROJECTNAME/MOUNTPOINT
url = https://PROJECT.googlecode.com/git
或者使用git config --add
命令:
git config --add remote.everyone.url https://github.com/USERNAME/REPOSITORY.git
git config --add remote.everyone.url ssh://USERNAME@git.code.sf.net/p/PROJECTNAME/MOUNTPOINT
git config --add remote.everyone.url https://PROJECT.googlecode.com/git
现在当您键入git push everyone master
时,您将把主分支推送到所有三个远程仓库。
感谢这个 Stack Overflow 回答提供的线索。