我已經在位於Windows系統中的Apache http服務器上發佈了幾個git存儲庫。這些文件保存在同一臺計算機上。現在我想將這些git存儲庫移動到另一臺計算機上,其中還有一個帶有gitweb的Apache http服務器。通常我使用git clone http://[email protected]/git/repository_name
將這些存儲庫克隆到其他本地機器中。如何將git存儲庫從Windows移動到Ubuntu服務器?
但是,當我直接將這些git存儲庫複製到一個git根目錄中時,git clone
將報告有關info/refs
的一個錯誤。
有沒有任何有效的方法來完成這項工作?謝謝。
更新:
在Windows 7電腦,我保存這些資料庫中F:/gitroot
目錄。而在httpd.conf
,相關配置如下:
SetEnv GIT_PROJECT_ROOT F:/gitroot
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAlias /git/ "D:/Program Files/Git/libexec/git-core/git-http-backend.exe/"
<Directory "D:/Program Files/Git/libexec/git-core/">
Allow From All
</Directory>
<Directory "F:/gitroot">
Options All
AllowOverride None
Order Deny,Allow
Deny From All
Allow From 192.168.0.0/24
Allow From 127.0.0.1
Allow From All
</Directory>
<Location /git >
AuthType Basic
AuthName "Git repository"
AuthUserFile F:/gitroot/htpasswd
Require valid-user
</Location>
,併爲清楚起見,我讓評爲F:/gitroot
test
一個新的目錄,然後進入test
目錄,git init --bare
,那麼我們可以初始化一個Git倉庫。然後在其他計算機上,我們可以使用git clone http://[email protected]_ipaddress/git/test
來克隆此存儲庫進行開發。此外,我們可以使用git push/pull origin master
來執行有關git更新或修改git存儲庫的操作。
現在,我想將這些存儲庫在F:/gitroot
中移動到另一臺操作系統爲Ubuntu 12.04
的計算機上,並且還安裝了apache服務器並使用gitweb配置了用於http訪問的apache服務器,就像在Windows系統中一樣。我只是將這些文件F:/gitroot
複製到Ubuntu電腦的/media/backup_data/gitroot
中。這些git倉庫的結構沒有改變。
當我使用git clone http://[email protected]_ipaddress/git/test
,錯誤的是:
Cloning into 'test'...
fatal: http://192.168.0.2/git/test/info/refs not found: did you run git update-server-info on the server?
最後,我找到了答案:我們應該改變複製的目錄中的權限。
sudo chown -R www-data:www-data test
然後,git clone
將成功執行。
你的意思是說你通常使用'git clone',但這次只是做了一個文件系統副本的副本?請包含來自Git的完整錯誤消息。 – 2014-11-03 06:35:24
@MagnusBäck,謝謝你的回覆!我找到了原因並更新了帖子,請檢查它! – mining 2014-11-03 07:08:15