在没有安装git-annex的服务器上托管Git附件


9

机器A和B托管一个共同的git附件库。他们都安装了git-annex程序,我在两台机器上手动编辑/提交/ etc等东西。A&B未同时连接到互联网,因此无法直接同步。

服务器C始终打开并连接(并且免费且非常安全)。它已安装git,但我没有管理员权限,所以我无法安装git-annex。

我的问题:我可以使用Server C作为中心集线器从A和B推送和提取git-annex更新,而无需在C上安装git-annex和整个haskell ghc依赖项吗?

我尝试使用带有“目录”或“rsync” 特殊遥控器的C,但这似乎只保存文件,而不是在推/拉后更新A和B所需的其余部分。

任何暗示都将非常感激!

Answers:


6

使用git和rsync访问同一服务器,您可以使用该服务器存储历史记录(通过git访问)和附件键值存储(通过rsync访问)。这些也可以解耦并存储在任意数量的不同服务器上。

看起来您已经阅读了所有需要的工具。基本上,你最终会得到两个独立的遥控器,它们都指向server-c上的不同位置。第一个远程(server-c)是一个常规的git远程,用于同步你的历史记录和直接检查到git仓库的任何东西。第二个遥控器是附件特殊遥控器。

[remote "server-c"]
    url = git@example.com:/path/to/repo.git
    fetch = +refs/heads/*:refs/remotes/server-c/*
[remote "server-c-rsync"]
    annex-rsyncurl = example.com:/home/user/annex-rsync
    annex-uuid = ...

您应该可以通过以下方式设置:

git remote add server-c git@example.com:/path/to/repo.git
git annex initremote server-c-rsync type=rsync rsyncurl=example.com:/home/user/annex-rsync encryption=none

这应该为您提供您正在寻找的基本功能。唯一的缺点是你有两个不同的远程名称真正指向同一台服务器。特别是在使用get,copy和move的--to =或--from =参数时,您必须记住使用特殊的远程(server-c-rsync)。

可以将单个遥控器指向两个位置,但是我不确定这是否实际上是支持的。以下命令似乎创建了一个合理的.git / config。

git init
git annex init "test"
git remote add server-c git@example.com:/path/to/repo.git
git annex initremote server-c type=rsync rsyncurl=example.com:/rsync/user encryption=none

对我来说,这导致.git / config中的单个远程同时具有url =(对于正常的git操作)和annex-rsyncurl =。但是,我没有进一步测试这个以确保git附件忽略url并且在使用附件文件时仅使用annex-rsyncurl条目。


大!我会做一些测试,但这应该让我非常接近一个可行的解决方案。非常感谢您的时间和答案!
— 文森特

很高兴我能帮助你。我刚开始在假期休息时使用git附件,到目前为止我对它非常满意!
— Justin Geibel 2013年

我认为最后一个例子应该可行。事实上,我认为它会rsync文件到位,即使它只是一个简单的git repo ...
— anarcat
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.