2013-06-23 39 views
0

我不明白爲什麼命令git pull origin master自從我升級到Ubuntu 12.04後就停止了我的計算機的工作,該命令適用於所有其他計算機和服務器。這是我做我的電腦上:。Git返回的錯誤:401(curl_result = 22,http_code = 401,sha1 =

mkdir gittest 
cd gittest 
git init 
git remote add origin http://[email protected]/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://[email protected]/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 

如前所述,我從任何其他計算機(Mac,Windows,Linux等)沒有問題。我試着運行git gc和git update-server-info。但是在我的個人電腦上也出現了同樣的錯誤。

發生了什麼事?

附加信息:我從一個不同的服務器,如https://github.com/abraham/twitteroauth.git,從一個URL做一個git pull沒有問題。所以這似乎是特定於我的服務器和我的電腦。

附加信息2:好的,如果我的起源網址是http://johnuser:[email protected]/websiteproject,我可以做一個git pull。但是現在,當我嘗試git的推動下,終端約15分鐘掛出了我下面的錯誤之前:

Unable to refresh lock for http://johnuser:[email protected]/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] 

回答

1

OK,我解決了這個問題。

我做的第一件事是將遠程URL從http://[email protected]/websiteproject更改爲http://johnuser:[email protected]/websiteproject。所以,我把密碼放在我的網址中。

這解決了我的git pull問題。但是,我開始獲得412鎖定。爲了解決這個問題,我的電腦上,我創建的文件~/.netrc-file,內容如下:

machine git.mywebsite.com 
login johnuser 
password mypassword 

然後,我能夠做一個混帳推。