git-update-server-info 不足以克隆远程仓库?

发布于 2024-09-18 14:01:02 字数 917 浏览 2 评论 0原文

我想通过 Nginx HTTPS 服务器提供 git 存储库。

我已设置提交后挂钩来运行 git-update-server-info ,以便更新“哑”后端的引用。

通过 HTTPS 接口提取更新工作正常,但是,在最初检查存储库时会失败:

[test@test ttt]$ git clone https://server/git/test.git/
Cloning into thesis...
Username: 
Password: 
error: The requested URL returned error: 401 (curl_result = 22, http_code = 401, sha1 = 2be2bcc15d1a79eb4e37e03fd2070ee0f229457c)
error: Unable to find 2be2bcc15d1a79eb4e37e03fd2070ee0f229457c under https://test/git/test.git
Cannot obtain needed commit 2be2bcc15d1a79eb4e37e03fd2070ee0f229457c
while processing commit 6c155f7098fd75f23edf71ac5b70b7c22f6070e7.
error: Fetch failed.

在服务器端存储库上手动运行“git update-server-info”并不能解决问题,但运行“git gc”可以解决问题。

但是,“git gc”修复仅在我将更新推送到服务器之前有效,之后整个“git clone”问题再次开始。

在服务器上我运行 git 1.7.1 (来自 Debian backports),在客户端上运行 1.7.2.2 (来自 Arch Linux)

关于如何解决这个问题有任何提示吗?不幸的是,运行“智能”HTTP 后端目前不是一个选项。

I'd like to make a git repository available over a Nginx HTTPS server.

I've set the post-commit hook to run git-update-server-info in order to update the refs for the "dumb" backend.

Pulling updates over the HTTPS interface works fine, however, when initially checking out the repository it fails with:

[test@test ttt]$ git clone https://server/git/test.git/
Cloning into thesis...
Username: 
Password: 
error: The requested URL returned error: 401 (curl_result = 22, http_code = 401, sha1 = 2be2bcc15d1a79eb4e37e03fd2070ee0f229457c)
error: Unable to find 2be2bcc15d1a79eb4e37e03fd2070ee0f229457c under https://test/git/test.git
Cannot obtain needed commit 2be2bcc15d1a79eb4e37e03fd2070ee0f229457c
while processing commit 6c155f7098fd75f23edf71ac5b70b7c22f6070e7.
error: Fetch failed.

Manually running "git update-server-info" on the server-side repository does not fix the problem, but running "git gc" does.

However, the "git gc" fix only works until I push an update to the server, afterwards the whole "git clone" problem starts again.

On the server I'm running git 1.7.1 (from the Debian backports), on the client I'm running 1.7.2.2 (from Arch Linux)

Any hints on how to solve this problem? Unfortunately running the "smart" HTTP backend is currently not an option.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

有同样的错误,但在 URL 中包含用户名对我有用:

https://myuser@server/git/test.git/

Had the same error but including the username in the URL works for me:

https://myuser@server/git/test.git/
舂唻埖巳落 2024-09-25 14:01:02

我这里也有同样的问题,对我来说这似乎是一个错误:虽然 git 要求输入用户名和密码,但它不会将其传递给服务器,因此服务器正确响应 401(未经授权)。

到目前为止我找到的唯一解决方案:正确设置我的 netrc。只需将

machine <server>
login <username>
password <password>

msysgit 的 $HOME/.netrc 或 $HOME/_netrc 放入其中,身份验证就会正常完成。

I have the same problem here, it seems like a bug to me: although git asks for username and password, it does not pass it to the server so the server correctly responds with a 401 (not authorized).

Only solution I found so far: setting up my netrc correctly. Simply put

machine <server>
login <username>
password <password>

in your $HOME/.netrc or $HOME/_netrc for msysgit, and the authentication will complete normally.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文