2016-02-24 55 views
2

設置:在工作中,我們有一個git倉庫,我們的腳本是。這些腳本需要在我們所有的客戶端Linux機器(〜400)上都可以訪問。目前的解決方案是有一個文件服務器,它定期提取主分支。然後掛載(nfs + autofs)。有沒有辦法在Linux上掛載git分支(只讀)?

問題:有沒有簡單的方法來掛載遠程git分支只讀?

我知道GitFS,但這似乎是矯枉過正。我正在尋找輕量級的內存,最好是在內存中,即不檢查磁盤上的東西。我只需要訪問一個分支,沒有歷史記錄。

編輯:要clearify這樣的:我想避免拉扯和cronjobs和這樣的東西。最好是透明地掛載遠程git倉庫,就像只讀nfs掛載。

回答

1

問:是否有一個簡單的方法來安裝一個遠程的Git分支只讀?

是的,你可以用幾種方法做到這一點。 bundle & archive是一個read-only存儲庫。

git bundle

# Clone the desired branch (-b flag) 
# and pack it into a bundle with the desired name 
git clone repo.bundle repo-copy -b master 

的這個輸出是包含在只讀模式所需的分支,因爲它不是一個git倉庫的單個文件。


git archive

類似上述bundle命令

# Create a tar archive that contains the contents of the latest commit 
# on the current branch, and 
#extract it in the /var/tmp/junk directory. 
git archive --format=tar --prefix=junk/ HEAD | (cd /var/tmp/ && tar xf -) 
+0

@codeWizerd有沒有在你的答案遠程倉庫的安裝。或者我錯過了什麼? –

相關問題