簡體   English   中英

推送時更新git remote repo

[英]Update git remote repo on push

在服務器上

  • 我在Web應用程序/ html的工作目錄中創建了一個git repo。

  • 為了創建一個git clone --bare html html.git ' git clone --bare html html.git ,我運行了git clone --bare html html.git

  • 我現在在/html.git(host)&/ html(client)的遠程服務器上有一個git'host'存儲庫和一個git'client'存儲庫。

我想從本地計算機推送到服務器,而不必在服務器上進行git pull

在我的本地機器上

當我從本地計算機推送到遠程“主機”存儲庫時,我想使用后接收掛鈎在遠程“客戶端”存儲庫上運行git pull

這可能嗎,或者這是最簡單的方法嗎?

要嘗試使用此方法: http : //toroid.org/ams/git-website-howto

應該有可能。 git鈎子只是提供了一些有用參數的普通腳本,因此(假設git用戶可以訪問兩個存儲庫),您應該能夠執行以下操作:

cd /path/to/client/repo && git pull host master

您可以直接從“主機”存儲庫中推送到客戶端,而不必在遠程“客戶端”存儲庫中運行git pull

在/path/to/host/repo/.git/hooks/post-receive中,只需輸入以下內容:

#!/bin/bash
git push ../html master

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM