我对GIT相当陌生,总体来说在基础设施方面不是很有经验。 然而,我想要做的似乎是非常基本的,我不能做到这一点。
我正在尝试通过Apache中的HTTPS创build一个GIT服务器。 我有我的GIT仓库的configuration(在CentOS系统上):
SetEnv GIT_PROJECT_ROOT /opt/repo-git/my-custom-repo.git SetEnv GIT_HTTP_EXPORT_ALL ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/ SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER <Directory "/opt/repo-git/my-custom-repo.git"> Options -Indexes FollowSymLinks AllowOverride AuthConfig FileInfo Order allow,deny Allow from all </Directory> <Directory "/usr/libexec/git-core"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> <Location /git> Order deny,allow Allow from all Dav on AuthType Basic AuthzLDAPAuthoritative on AuthName "Trac" Require valid-user AuthBasicProvider ldap AuthLDAPURL "ldap://my-ldap-configuration-that-works" AuthLDAPBindDN "my-ldap-dn" AuthLDAPBindPassword "my-password" </Location>
有了这个configuration,我可以使用git clone https://<my-ip>/git来检出代码。 但是我无法推动我在TortoiseGit中得到以下错误:
Counting objects: 3, done. Writing objects: 100% (3/3), 207 bytes | 0 bytes/s, done. Total 3 (delta 0), reused 0 (delta 0) remote: error: insufficient permission for adding an object to repository database ./objects remote: fatal: failed to write object error: unpack failed: unpack-objects abnormal exit To https://<my-ip>/git ! [remote rejected] master -> master (unpacker error) error: failed to push some refs to 'https://<my-ip>/git'
这样的错误报告在这里 , 在 这里 ,还有更多的地方。
这些来源都没有对我有帮助 – 他们实际上提出了同样的事情。 我无法得到的是我应该为存储库设置什么组和所有者。 我目前正在设置apache ,这是运行Apache服务器的用户。 不过,我怀疑Apacheconfiguration中的GIT魔术会使用其他用户来提交我的提交(例如,我的LDAP用户)。 这是没有道理的,但是,我是否每次更改LDAP中的更改时都要更改每个服务器上的文件权限?
有没有特别的默认git用户在这样的configuration中使用?
我确认apache用户和组对我的GIT存储库有完全的控制权。
我能够让Gitconfiguration为我工作。
我的目标configuration是将GIT设置为存储库,将GERRIT设置为代码审查,并将所有这些与我公司的LDAP进行集成。
你可以看到花了差不多三个星期的时间才完成了,但现在我终于明白了。
GERRIT是最重要的里程碑 – 事实certificate,它提供了我自己需要的function – 它为存储库提供http界面,然后使用一个系统帐户在存储库上执行实际操作。
GERRIT还与LDAP完美集成,允许您为项目访问权限configurationldap组,并使用LDAP用户进行存储库交互。
唯一的小问题是,需要使用GERRIT生成的密码和他的LDAP用户访问存储库。 但是,这不是一个巨大的缺陷,因为您使用完整的LDAP凭据loginGERRIT UI,然后可以为自己生成此密码,这意味着您可以完全控制它。