![](/img/trans.png)
[英]How to change a git repository cloned with --bare to match one cloned with --mirror?
[英]How to change git-bare repository location due to space issues?
我在x:/Archivos Python/EPPTRA2.git/
下有一個git-bare
信息庫位置,所有團隊都在從該信息庫中提取和推送更改。 /x
是我們辦公室網絡內的共享磁盤。
但是最近我不得不推送許多大文件,發現空間不足。
$ git push
Counting objects: 1077, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (1073/1073), done.
remote: fatal: write error: Not enough space
fatal: sha1 file '<stdout>' write error: Broken pipe
error: failed to push some refs to 'x:/Archivos Python/EPPTRA2.git/'
我想將git-bare
存儲庫移動到另一個位置,比方說/s/EPPTRA.git/
,它位於其他具有足夠空間的共享網絡磁盤中。 然后更新隊友的本地存儲庫,以確保它們指向新的git-bare
存儲庫位置。
如何更改git-bare
信息庫的位置?
如何將我的最后一次提交推送到新的git-bare
存儲庫位置?
在我所有團隊成員都指向git-bare
資源庫的新位置之后,我需要執行哪些步驟?
我正在尋找來自git-bash
的命令以執行這些任務。
它相信我可以實現我想要的目標。 我想可能還有其他方法。
首先,從新位置/s
創建一個裸倉庫:
$ cd /s
$ git init --bare EPPTRA2.git
Initialized empty Git repository in S:/EPPTRA2.git/
之后,我去了一個非裸存儲庫,它不是我的最后提交,並將該存儲庫鏡像到裸存儲庫(實際上,我在/s/epptra2
下有一個非裸存儲庫,可以使用那個存儲庫):
$ cd /s/epptra2
$ git push --mirror /s/epptra2.git
Counting objects: 22412, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (7300/7300), done.
Writing objects: 100% (22412/22412), 1.68 GiB | 1.96 MiB/s, done.
Total 22412 (delta 17271), reused 19487 (delta 15075)
然后,我必須刪除先前的原點並創建一個新的原點:
$ cd /d/epptra2
$ git remote rm origin
$ git remote add origin /s/epptra2.git
$ git config master.remote origin
$ git config master.merge refs/heads/master
$ git branch -u origin/master
最后,我從本地存儲庫推送了我所做的提交:
$ git push
Counting objects: 1077, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (1073/1073), done.
Writing objects: 100% (1077/1077), 4.53 GiB | 922.00 KiB/s, done.
Total 1077 (delta 441), reused 0 (delta 0)
To S:/epptra2.git
da05677..d1c8610 master -> master
對於隊友的本地存儲庫,我必須重復步驟3 ,然后執行git pull
以確保一切正常。
注意 : /d
是PC上的本地磁盤, /s
和/x
是網絡安裝的驅動器。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.