41

基本的に私は次のようなことをしたかったgit push mybranch to repo1, repo2, repo3

現在、私は push を何度も入力しているだけで、急いでプッシュを完了したい場合は、それらすべてをバックグラウンドに送信するだけですgit push repo1 & git push repo2 &

私がgitやりたいことをネイティブにサポートしているかどうか、またはそこに巧妙なスクリプトがあるかどうか、またはローカルリポジトリ構成ファイルを編集して、ブランチを複数のリモートにプッシュする必要があると言う方法があるかどうか疑問に思っています。

4

2 に答える 2

79

git では、リモートごとに複数の URL を使用できますが、git remoteコマンドは最後に確認したものを公開していないように見えます。に.git/config、次のように入力します。

[remote "public"]
    url = git@github.com:kch/inheritable_templates.git
    url = kch@homeserver:projects/inheritable_templates.git

これで、「<code>git push public」と言って、両方のリポジトリに一度にプッシュできます。

于 2008-10-03T09:10:20.287 に答える
9

私がしていることは、プッシュ先のホーム ディレクトリに存在する単一のベア リポジトリを用意することです。次に、そのリポジトリの更新後のフックが、公開されている他のいくつかの場所にプッシュまたは再同期します。

ここに私のフック/ポストアップデートがあります:

#!/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/ afranco@slug.middlebury.edu:/srv/www/htdocs/git/

# Upload to github
git-push --mirror github 
于 2008-10-02T23:58:55.073 に答える