将 Gitolite 服务器上的存储库推送到 Gitolite,同时也能够从客户端推送和拉取
我有一个 Gitolite 服务器,我将网站源代码推送到其中。然后,服务器使用挂钩将存储库克隆到网站文件夹中。我希望能够在我的网站中更改 PHP 脚本中的文件,然后让 PHP 脚本自动添加、提交并将这些更改的文件推送回 Gitolite 服务器。
到目前为止,我已经成功添加并提交了文件,但无法推送它们。如果我尝试推送到存储库的本地引用,我会被告知它似乎不是一个存储库(我认为这是一个文件权限问题,因为它与 sudo 一起使用),如果我尝试通过 SSH 推送,我不能指定一个私钥,因为我在 Lion Server 中的 _www 用户下运行它。是否可以本地推送到本地 Gitolite 存储库?
I have a Gitolite server which I push my website source code to. The server then clones the repo into the websites folder using a hook. I would like to be able to change files in a PHP script in my website then have the PHP script automatically add, commit, and push these changed files back to the Gitolite server.
So far, I've managed to add and commit the files, but I cannot push them. If I try to push to the local reference to the repository, I am told it doesn't appear to be a repo (a file permissions problem I think as it worked with sudo), and if I try to push via SSH, I cannot specify a private key as I'm running this under the _www user in Lion Server. Is it possible to push locally to a local Gitolite repo?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
推送到 Gitolite 的想法是确保 Gitolite 可以获取您的 id,以便将此 id 与其内部授权配置文件一起使用。
使用 ssh 是一个很好的方法(因为在 Gitolite 中注册的公钥名称将用作您的 ID 名称)
因此:
_www
用户有权推送到您的repo~_www/.ssh
下有一个公钥/私钥才能供推送使用,_www
用户的公钥添加到 gitolite 密钥中。OP enovav 评论说:
_www
用户没有主文件夹。/Library/WebServer
中查找 SSH 密钥。_www
用户,但是 此线程解释了如何操作。 (chsh -u Admin _www
将 shell 从 /bin/false 更改)。The idea with pushing to Gitolite is to make sure Gitolite can get your id, in order to use this id with its internal authorization config file.
Using ssh is a good way to do that (since the name of the public key registered in Gitolite will be used as your id name)
So:
_www
user is authorized to push to your repo~_www/.ssh
to be used by your push_www
user to gitolite keys.The OP enovav comments that:
_www
user does not have a home folder./Library/WebServer
._www
user, however this thread explains how. (chsh -u Admin _www
to change the shell from /bin/false).