2011-10-31 66 views
2

我們想使用mercurial進行web開發,但是我們不能(也不想)在共享主機上安裝mercurial。我們嘗試使用wget,如here所述,但我得到401錯誤。 憑據和鏈接是正確的(爲了安全性而修改)。Wget從Bitbucket壓縮的提示(mercurial)

有沒有辦法從命令行下載源代碼?

是這個錯誤還是我做錯了什麼?

迴應如下:

$ wget _http://xxxx:[email protected]/username/repo/get/be51983f6357.zip 
--2011-10-31 00:26:50-- 
http://username:[email protected]/username/repo/get/be51983f6357.zip 
Resolving bitbucket.org... 207.223.240.182, 207.223.240.181 
Connecting to bitbucket.org|207.223.240.182|:80... connected. 

HTTP request sent, awaiting response... 
301 Moved Permanently Location: https://bitbucket.org/username/repo/get/be51983f6357.zip [following] 
--2011-10-31 00:26:51-- 
https://bitbucket.org/username/repo/get/get/be51983f6357.zip 
Connecting to bitbucket.org|207.223.240.182|:443... connected. 
HTTP request sent, awaiting response... 
401 UNAUTHORIZED Authorization failed. 

以2:

thanx的幫助......我改變HTTP到HTTPS和用戶的用戶密碼&屬性:

瀏覽器工作正常,Wget的不...

$ wget --verbose --user=XXXXX --password=YYYY https://bitbucket.org/ekku/REPO/get/aabbccddeee.zip 
--2011-10-31 18:27:10-- https://bitbucket.org/ekku/REPO/get/aabbccddeee.zip 
Resolving bitbucket.org... 207.223.240.182, 207.223.240.181 
Connecting to bitbucket.org|207.223.240.182|:443... connected. 
HTTP request sent, awaiting response... 401 UNAUTHORIZED 
Failed writing HTTP request: Bad file descriptor. 
Retrying. 

以3:

我也嘗試捲曲,但我得到錯誤消息: 禁止(403) CSRF驗證失敗。請求中止。

+0

嘗試直接點擊HTTPS網址。你正在訪問HTTP,並且wget最有可能不會通過重定向傳遞嵌入了url的憑據。 –

+0

改爲使用'--user'和'--password'命令行選項。 –

+1

我得到了它的捲曲工作: 捲曲--digest --user用戶名:密碼https://bitbucket.org/user/repo/get/tip.zip -o test.zip從到位桶 答:HTTPS ://bitbucket.org/site/master/issue/3225/commanline-download-compressed-tip Hi Esa, 我們實際上並不支持源碼包下載的基本身份驗證。 您需要使用摘要身份驗證。另外,據我所知,wget有一個摘要認證實現的bug。 可以使用curl和--digest標誌和-o標誌來指定輸出文件。 歡呼聲, Dylan – Esa

回答

8

我得到它的,捲曲的工作:

curl --digest --user username:password https://bitbucket.org/user/repo/get/tip.zip -o test.zip  

回答到位桶:Issue #3225 - Commanline download compressed tip

嗨ESA,我們實際上並不支持基本身份驗證源捆綁下載。你需要使用摘要認證。另外,據我所知,wget有一個摘要認證實現的bug。您可以使用curl和--digest標誌和-o標誌來指定您的輸出文件。乾杯,迪倫

+0

謝謝,它適用於我! (2013年7月) – mzalazar

0

您不應使用http以上的bitbucket;始終使用https。這應該擺脫你看到的額外的重定向。

還可以使用命令行選項--user--password和指定wget認證; SSL可能不允許向URL添加用戶和密碼,因爲服務器部分(在://和下一個/之間)以純文本格式發送到服務器。