【问题标题】:Wget compressed tip from Bitbucket (mercurial)Wget 来自 Bitbucket (mercurial) 的压缩提示
【发布时间】:2011-12-18 19:26:27
【问题描述】:

我们想使用 mercurial 进行 Web 开发,但我们不能(也不想)在共享主机上安装 mercurial。我们尝试使用here 中提到的 wget,但出现 401 错误。 凭据和链接正确(为安全起见已修改)。

有没有办法从命令行下载源码?

这是错误还是我做错了什么?

回复如下:

$ wget _http://xxxx:yyyyyyy@bitbucket.org/username/repo/get/be51983f6357.zip 
--2011-10-31 00:26:50--
http://username:password@bitbucket.org/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:

感谢帮助...我将 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:

我也尝试过 curl,但我收到错误消息: 禁止 (403) CSRF 验证失败。请求中止。

【问题讨论】:

  • 尝试直接访问 HTTPS 网址。您正在访问 HTTP,而 wget 很可能不会通过重定向传递嵌入 url 的凭据。
  • 改用--user--password 命令行选项。
  • 我用 curl 得到了它: curl --digest --user username:password bitbucket.org/user/repo/get/tip.zip -o test.zip bitbucket 的回答:bitbucket.org/site/master/issue/3225/… 您好 Esa,我们实际上不支持基本auth 用于下载源包。您需要使用摘要身份验证。另外,据我了解, wget 的摘要身份验证实现存在错误。您可以将 curl 与 --digest 标志和 -o 标志一起使用来指定输出文件。干杯,迪伦

标签: mercurial wget bitbucket


【解决方案1】:

您不应该在http 上使用bitbucket;始终使用https。这应该可以消除您看到的额外重定向。

还可以使用命令行选项--user--password 指定wget 的身份验证; SSL 可能不允许向 URL 添加用户和密码,因为服务器部分(在:// 和下一个/ 之间)是以纯文本形式发送到服务器的。

【讨论】:

    【解决方案2】:

    我得到了它与 curl 一起使用:

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

    来自 Bitbucket 的回答:Issue #3225 - Commanline download compressed tip

    您好 Esa,我们实际上不支持下载源包的基本身份验证。您需要使用摘要身份验证。另外,据我了解, wget 的摘要身份验证实现存在错误。您可以将 curl 与 --digest 标志和 -o 标志一起使用来指定输出文件。干杯,迪伦

    【讨论】:

      猜你喜欢
      • 2010-12-16
      • 1970-01-01
      • 2012-10-16
      • 2011-08-09
      • 1970-01-01
      • 2012-10-24
      • 1970-01-01
      • 1970-01-01
      • 2011-06-01
      相关资源
      最近更新 更多