【问题标题】:How to change git-bare repository location due to space issues?由于空间问题,如何更改 git-bare 存储库位置?
【发布时间】:2018-09-18 15:00:00
【问题描述】:

我在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 的命令以执行这些任务。

【问题讨论】:

  • 这个article 可以成为我问题解决方案的一部分吗?
  • @phd 您提到的帖子不适用于裸存储库。我相信这不是重复的。我彻底搜索了答案,但没有找到我要找的东西。
  • 将存储库作为目录移动时,裸存储库和非裸存储库没有太大区别。
  • 我检查了非裸存储库和裸存储库目录 epptra2.git 中 .git 的大小,它们的大小不同。另外在您提到的问题上,我没有找到如何更改我需要为所有团队成员更改的远程源位置(我在自己的回答中说明的第 5 步)

标签: git push git-bash git-bare


【解决方案1】:

我相信我可以正确地实现我想要的。我想可能还有其他方法。

第 1 步:创建新的 git-bare 存储库

首先从新位置/s 我创建了一个裸仓库:

$ cd /s
$ git init --bare EPPTRA2.git
Initialized empty Git repository in S:/EPPTRA2.git/

第 2 步:将非裸存储库镜像到新的 git-bare 存储库

之后我去了一个非裸存储库,这不是我最后一次提交,并将存储库镜像到裸存储库(我实际上在/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)

第 3 步:更改远程起始位置

然后我必须删除以前的原点并创建一个新的:

$ 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

第 4 步:将已提交的更改推送到新的裸存储库

最后我从本地存储库推送了我所做的提交:

$ 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

第 5 步:更新所有本地存储库的远程源

对于我队友的本地存储库,我必须重复第 3 步,然后执行git pull 以确保一切正常。

注意/d 是我 PC 中的本地磁盘,/s/x 是网络安装的驱动器。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-07-08
    • 2022-06-11
    • 2012-09-03
    • 1970-01-01
    • 1970-01-01
    • 2013-08-25
    • 2015-04-04
    • 2010-12-08
    相关资源
    最近更新 更多