我是 gitolite 的新手。我正在尝试用 gitolite 做一个非常简单的测试。我已经设置了名为“test_repo”的存储库。请注意,除了我在下面声明的内容之外,我没有修改任何其他内容。我可以在 gitweb 中看到这个 repo。这是 repo 配置
repo test_repo
RW+ = @all
现在我想克隆这个 repo。我有 ldap 访问服务器。根据我对@all 的理解,它应该允许我这样做。
当我发布
git clone git@myserver:repositories/test_repo.git
#I know this is wrong. But I just wanted to test as the above did not work
或
git clone git@myserver:test_repo.git
它要求输入密码。我已遵循本指南 http://sharadchhetri.com/2013/05/31/how-to-create-own-git-server-with-gitolite-and-gitweb-in-ubuntu/ , 它没有为 git 用户设置密码
当我发出
git clone myname@myserver:test_repo.git
我收到以下错误
fatal: 'test_repo.git' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我也厌倦了克隆默认的 repo“test_repo.git”。但我遇到了同样的错误。
我也厌倦了这个
git clone myname@myserver:/home/git/repositories/testing.git
然后克隆就开始工作了。但是当我执行 git push -u origin master
一些修改过的文件时,我得到了
error: insufficient permission for adding an object to repository database ./objects
fatal: failed to write object
error: unpack failed: unpack-objects abnormal exit
! [remote rejected] master -> master (n/a (unpacker error))
注意:我没有在conf文件中添加任何用户
感谢任何帮助。
最佳答案
git clone myname@myserver:/home/git/repositories/testing.git
- 完全绕过gitolite,它不叫
- 使用错误的帐户“myname”,该帐户无权读取 git 帐户文件夹。
应该起作用的是:
git clone git@myserver:test_repo.git
or
git clone git@myserver/test_repo.git
你不应该指定 'repositories' 文件夹(gitolite 知道 repo 应该在哪里)
假设 ssh -Tvvv git@myserver
有效(即不询问密码)。
首先使 ssh 工作,然后再次尝试 git clone
。
正如我在评论中所说,LDAP 和 ssh 都是身份验证机制,因此您可以使用或另一个,不能同时使用:
- Https + LDAP + gitolite:see an example here .
- 或者 SSH + gitolite
如果 ssh 有效,但克隆无效,那么您需要在 ~git/.gitolite/logs
中查看 gitolite 日志
I could not find anything useful in the log. Moreover I did a
tail -f
of the log file. Its not even updated when I try to clone.
这意味着问题出在 ssh 级别,没有正确调用 gitolite:这是在 ~git/.ssh/authorized_keys
中,如果您直接在其中手动添加 ssh key ,而不是通过 gitolite-admin
存储库的 keys
文件夹添加并将该存储库推送回 gitolite 服务器(这会触发上述 ~git/.ssh/authorized_keys 文件
的更新)。
I think that could be the reason. I have no idea what just happened. I can even clone
gitolite-admin
, in admin server (this was working earlier).
I will re install every thing (because I think I messed up a lot with config files by now).
关于带有 LDAP 的 Gitolite 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17990402/