基本上我想做一些像git push mybranch to repo1, repo2, repo3
我可以在git中的單個命令中推送到多個存儲庫嗎?
現在我只是打字推了很多次,如果我有急事到了推做的時候,我只是他們都發送到後臺git push repo1 & git push repo2 &
我只是想知道,git
原生支持我想要做什麼,或者如果可能有一個聰明的腳本在那裏,或者編輯本地回購配置文件,以說分支應推到多個遙控器。
基本上我想做一些像git push mybranch to repo1, repo2, repo3
我可以在git中的單個命令中推送到多個存儲庫嗎?
現在我只是打字推了很多次,如果我有急事到了推做的時候,我只是他們都發送到後臺git push repo1 & git push repo2 &
我只是想知道,git
原生支持我想要做什麼,或者如果可能有一個聰明的腳本在那裏,或者編輯本地回購配置文件,以說分支應推到多個遙控器。
您可以爲每個遠程多個URL中的git,即使git remote
命令似乎沒有暴露這最後我檢查。在.git/config
,把這樣的事情:
[remote "public"]
url = [email protected]:kch/inheritable_templates.git
url = [email protected]:projects/inheritable_templates.git
現在你可以說「git push public
」推到兩個回購一次。
我所做的只有一個裸存儲庫,它位於我推入的主目錄中。該存儲庫中的更新後的掛鉤然後推送或rsyncs到其他幾個公開可見的位置。
這裏是我的鉤/更新後:
#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, make this file executable by "chmod +x post-update".
# Update static info that will be used by git clients accessing
# the git directory over HTTP rather than the git protocol.
git-update-server-info
# Copy git repository files to my web server for HTTP serving.
rsync -av --delete -e ssh /home/afranco/repositories/public/ [email protected]:/srv/www/htdocs/git/
# Upload to github
git-push --mirror github
這很好。小心分享或解釋git-update-server-info? – kch 2008-10-03 00:00:57
正如我已經添加到答案:git-update-server-info寫入一些靜態信息文件,將由git客戶端通過HTTP而不是git協議訪問git目錄。 查看以下詳細信息: http://www.kernel.org/pub/software/scm/git/docs/git-update-server-info.html – 2008-10-03 22:03:15