使用http认证下载专用BitBucket存储库zip文件 [英] Download private BitBucket repository zip file using http authentication

查看:158
本文介绍了使用http认证下载专用BitBucket存储库zip文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写脚本以轻松部署应用程序。该应用程序的代码存储在一个专用的BitBucket存储库中。



我希望能够下载提交的zip文件。我尝试使用以下代码进行身份验证:



https:// user:pass@bitbucket.org/user/repo/get/commit .zip



然而,它不是完成任务,而是重定向到BitBucket上的登录页面。

  git archive --remote = ssh://git@bitbucket.org/your_bitbucket_username/your_repository.git --format = zip --output =name_of_your_desired_zip_file.zipmaster 

我的系统上有多个密钥,如果你也这样做,你需要在你的〜/ .ssh目录下创建一个配置文件,该文件指定使用特定的密钥进行bitbucket连接。

〜/ .ssh / config

  Host bitbucket.org 
StrictHostKeyChecking no
IdentityFile /home/me/.ssh/my_private_key


I'm writing a script to easily deploy an application. The code for the application is stored in a private BitBucket repository.

I'd like to be able to download a zip file of the commit. I've tried authenticating with the following code:

https://user:pass@bitbucket.org/user/repo/get/commit.zip

However, instead of accomplishing the task it redirects to the login page on BitBucket.

解决方案

Personally, I didn't want to put my password into my script to accomplish this. So the trick was to run the following command, after adding your public key to your bitbucket account:

git archive --remote=ssh://git@bitbucket.org/your_bitbucket_username/your_repository.git --format=zip --output="name_of_your_desired_zip_file.zip" master

I have multiple keys on my system, if you do too, you will want to create a config file within your ~/.ssh directory that specifies to use a specific key for bitbucket connections.

~/.ssh/config

Host bitbucket.org
  StrictHostKeyChecking no
  IdentityFile /home/me/.ssh/my_private_key

这篇关于使用http认证下载专用BitBucket存储库zip文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆