0

我不明白为什么git pull origin master自从我升级到 ubuntu 12.04 后该命令就停止了我的计算机工作。该命令适用于所有其他计算机和服务器。这是我在电脑上所做的:

mkdir gittest
cd gittest
git init
git remote add origin http://johnuser@git.mywebsite.com/websiteproject
git pull origin master

系统提示我输入密码。所以我给了正确的密码。但是我自己的 ubuntu 12.04,我得到了这个错误:

error: The requested URL returned error: 401 (curl_result = 22, http_code = 401, sha1 = d32f1e47321f14d4391168f7b26ce37f0b585803)
error: Unable to find d32f1e47321f14d4391168f7b26ce37f0b585803 under http://johnuser@git.mywebsite.com/websiteproject
Cannot obtain needed blob d32f1e47321f14d4391168f7b26ce37f0b585803
while processing commit eba6849896d12c9652bbc75ffcbc36ab2fc9a847.
error: Fetch failed.

我查看了git.mywebsite.com/log/error.log,我看到以下错误:

[Sun Jun 23 13:43:00 2013] [error] [client 11.11.11.11] user johnuser: authentication failure for "/websiteproject/objects/cf/fe85cd3a4af8f2cced2bdddbaed72f150ec568": Password Mismatch

如前所述,我在任何其他计算机(macs、windows、linux 等)上都没有问题。我尝试运行 git gc 和 git update-server-info。但是我的个人电脑上也出现了同样的错误。

这是怎么回事?

附加信息:我从不同服务器(如https://github.com/abraham/twitteroauth.git. 所以这似乎是我的服务器和我的计算机特有的东西。

附加信息 2:好的,如果我的原始 url 是http://johnuser:mypassword@git.mywebsite.com/websiteproject. 但是现在当我尝试 git push 时,终端挂起大约 15 分钟,然后显示以下错误:

Unable to refresh lock for http://johnuser:mypassword@git.mywebsite.com/websiteproject/info/refs
LOCK HTTP error 412

我查看了 apache 错误日志并看到了这个:

[Sun Jun 23 14:26:36 2013] [error] [client 11.11.11.11] (2)No such file or directory: The precondition(s) specified by the "If:" header did not match this resource. At least one failure is because: a State-token was supplied, but it was not found in the locks on this resource.  [412, #0]
[Sun Jun 23 14:26:36 2013] [error] [client 11.11.11.11] Could not LOCK /websiteproject/info/refs due to a failed precondition (e.g. other locks).  [412, #0]
4

1 回答 1

1

好的,我解决了这个问题。

我做的第一件事是将远程 url 从 更改http://johnuser@git.mywebsite.com/websiteprojecthttp://johnuser:mypassword@git.mywebsite.com/websiteproject。也就是说,我将密码直接放入我的网址中。

这解决了我的 git pull 问题。但是,我开始锁定 412。为了解决这个问题,我在我的电脑上创建了~/.netrc-file包含以下内容的文件:

machine git.mywebsite.com
login johnuser
password mypassword

然后我就可以做一个 git push 了。

于 2013-06-23T19:53:05.453 回答