如何使用令牌操作 Bitbucket 存储库? [英] How to manipulate Bitbucket repository with token?

查看:21
本文介绍了如何使用令牌操作 Bitbucket 存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照此文档从 bitbucket 获取令牌值和令牌秘密:
https://confluence.atlassian.com/display/BITBUCKET/OAuth+on+Bitbucket

I followed this documentation to get a token value and a token secret from bitbucket:
https://confluence.atlassian.com/display/BITBUCKET/OAuth+on+Bitbucket

之后,我想使用该令牌推送/拉入给定的存储库.

After that I want to push/pull to a given repo by using that token.

在 Github,我可以这样使用令牌:https://help.github.com/articles/git-automation-with-oauth-tokens#step-2-clone-a-repository

At Github I can use the token like this way: https://help.github.com/articles/git-automation-with-oauth-tokens#step-2-clone-a-repository

我的问题是如何在 bitbucket (mercurial/git) 上使用这种 http 授权?

My question is how can I use this kind of http authorization at bitbucket (mercurial/git)?

推荐答案

这个 BitBucket 页面提及:

我们最近推出了 OAuth 2 并添加了将它们用作 HTTP 基本身份验证凭据.

We recently introduced OAuth 2 and also added the ability to use them as HTTP Basic Auth credentials.

由于附加组件无法上传自己的 SSH 密钥进行克隆,因此访问令牌可用作基本 HTTP 身份验证凭据以通过 HTTPS 安全地克隆.

Since add-ons will not be able to upload their own SSH keys to clone with, access tokens can be used as Basic HTTP Auth credentials to clone securely over HTTPS.

git clone https://x-token-auth:{access_token}@bitbucket.org/user/repo.git

需要字符串 x-token-auth 作为用户名的替代.

The literal string x-token-auth as a substitute for username is required.

我们的流程与 GitHub 类似,但略有不同:不同之处在于 GitHub 将实际令牌放在用户名字段中.

Our process is similar to GitHub, yet slightly different: the difference is GitHub puts the actual token in the username field.

Bitbucket Cloud 上的 OAuth",正如 在评论中nick graziano.

See more at "OAuth on Bitbucket Cloud", as suggested in the comments by nick graziano.

这篇关于如何使用令牌操作 Bitbucket 存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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