English 中文(简体)
吉唐·克洛恩与乌特人接触
原标题:GitHub Clone with OAuth Access Token

在一份文字中,我试图把一个Gite Hub存放处与一个OAuth脚踢。

根据这一理论:

https://github.com/blog/1270-easier-builds-and-dplos-using-git-over-https-and-oauth”rel=“noreferer”>https://github.com/blog/1270-easier-builds-and-dplos-using-git-over-https-and-oauth

我应该能够就此建立指挥:

git clone https://<token>@github.com/owner/repo.git

如果我能以适当的途径亲自尝试,那么我仍要提出我的密码。

如果我在指挥线上尝试,我就只是拿到一张<条码>,没有发现错误。

本条从2012年起,我无法找到任何针对此的APIC文件。 因此,我很想知道这是否仍然有效。

最佳回答

我认为这是范围问题。 当然,需要填写<代码>repo。 由于我试图打上<条码>的私人存放处。

令人羞耻的Github没有为这些事情提供更明确的错误信息,但安全是我理解的。

任何人在试图弄清像这样的东西时,试图弄清错误,我建议创造个人接触机会,充分接触一切:

环境和大体; 发育环境; 个人接触症状; 产生新症状

如果这是个范围问题,那么你就能够轻易地检验,把你被证明的人格与能够享有一切权利的人接触。

感谢那些花时间阅读的人。

问题回答

仅使用HTTPS地址与用户的钥匙相容,因此:

git clone https://oauth-key-goes-here@github.com/username/repo.git

git clone https://username:token@github.com/username/repo.git

存放处与吉大港定居地一样:

git clone https://github.com/myuser/myrepo.git

用户名在接任时填写用户名称。

接通口号时,填写token

请尝试这样做。

git clone `https://oauth2:TOKEN@github.com/username/repo.git`

例如,git Clone https://oauth2:ghp_...Gnm61dm4rh@github.com/gituser/testrepo.git

无论从这两项选择中为你们做什么工作

www.un.org/Depts/DGACM/index_spanish.htm 在您的终端上

$ git clone your_repo_url Username:your_token Password:

......没有密码

www.un.org/Depts/DGACM/index_spanish.htm 在您的客户中

i.e. Sourcetree、GiteKraken和Gite Hub客户。

进入贵重邮袋(明显没有高档部分)

Username:your_token Password:

......没有密码

OR i.e. in Sourcetree, open preferences and then go to advanced, enter the hostname (i.e. www.x.com) and userName (i.e. your_token)

“entergraph

?

仅对那些仍然有问题的人来说,“建立一个私人存放处,备有阅读的“FG”号:“再分配:不准许进入存放处的书写”。

错误信息只是误导。 就我而言,问题在于组合:

  1. Create a readonly token (content: readonly)
  2. Make sure the resource owner is properly set.
  3. For organizations, you have to complete "personal-access-tokens-onboarding".
  4. Clone the repository using https://oauth2:$TOKEN@github.com/myuser/myrepo.git (note the username, as suggested by others, it s oauth2)

综上所述,我设法把一个只读成像的私人存放处掩饰(没有,没有书写出入)?

在网上,你在处理DevOps Repo时可以这样做:

 public void CloneRepository()
        {
            var _gitURL = "URLofGitRemoteRepository";
            var _userName = "PersonalAccessToken";
            var _pswd = ""; //Keep it blank

            var co = new CloneOptions();
            co.CredentialsProvider = (_url, _user, _cred) => new UsernamePasswordCredentials { Username = _userName, Password = _pswd };

            Repository.Clone(_gitURL, filePath, co);
        }

象未来那样的民俗:

  1. https://github.com/gings/tokens"rel=“nofollow noretinger”>。 (在接下来的步骤中,这同前言一样。)

  2. a. 维持以下指挥。 这表明有必要储存全权证书(第3步行)。

    git config --global credential.helper manager-core
    git config --global credential.helper store
    
  3. 在您的首饰中,将请用户名和密码提供您从上面项目1获得的馈赠:

    git clone https://github.com/GithubUserName/repo-to-clone.git
    

不应要求你获得全权证书。

这一点应该与Gite 2.41(Q2 2023)更好地加以支持,而成形的子系统学会帮助奥阿瑟框架。

See commit a5c7656 (21 Apr 2023) by M Hickford (hickford).
(Merged by Junio C Hamano -- gitster -- in commit 2ca91d1, 10 May 2023)

credential: new attribute oauth_refresh_token

Git authentication with OAuth access token is supported by every popular Git host including GitHub, GitLab and BitBucket.
Credential helpers Git Credential Manager (GCM) and git-credential-oauth generate OAuth credentials.
Following RFC 6749, the application prints a link for the user to authorize access in browser.
A loopback redirect communicates the response including access token to the application.

For security, RFC 6749 recommends that OAuth response also includes expiry date and refresh token.
After expiry, applications can use the refresh token to generate a new access token without user reauthorization in browser.
GitLab and BitBucket set the expiry at two hours.
(GitHub doesn t populate expiry or refresh token.)

However the Git credential protocol has no attribute to store the OAuth refresh token (unrecognised attributes are silently discarded).
This means that the user has to regularly reauthorize the helper in browser.
On a browserless system, this is particularly intrusive, requiring a second device.

Introduce a new attribute oauth_refresh_token.
This is especially useful when a storage helper and a read-only OAuth helper are configured together.
Recall that credential fill calls each helper until it has a non-expired password.

    helper = storage  # eg. cache or osxkeychain
    helper = oauth

The OAuth helper can use the stored refresh token forwarded by credential fill to generate a fresh access token without opening the browser.
See https://github.com/hickford/git-credential-oauth/pull/3/files for an implementation tested with this patch.

Add support for the new attribute to credential-cache.
Eventually, I hope to see support in other popular storage helpers.

Alternatives considered: ask helpers to store all unrecognised attributes.
This seems excessively complex for no obvious gain.
Helpers would also need extra information to distinguish between confidential and non-confidential attributes.

Workarounds: GCM abuses the helper get/store/erase contract to store the refresh token during credential get as the password for a fictitious host (I wrote this hack).
This workaround is only feasible for a monolithic helper with its own storage.

rel=“nofollow noreferer”>man page :

oauth_refresh_token

An OAuth refresh token may accompany a password that is an OAuth access token. Helpers must treat this attribute as confidential like the password attribute. Git itself has no special behaviour for this attribute.

,引自2023,如果你能够正确进入既定范围,那就是一个克隆体(无需进一步互动):

git clone https://ghp_foo_etc:x-oauth-basic@github.com/bar/baz-phoenix.git

当格p_foo_etc是你获得象征性服务时。 这与私人回购中的食肉类接触法相类似。 没有必要提供用户名称。

我确信,它始终如此!





相关问题
git confusion - cloning a repo is returning a past version

Im having some confusion with my git usage. I cloned a repo from one comp to the other, and the new clone is the state of the original that was active some time ago. So its cloning a past version. ...

Appropriate strategy for tagging and hotfixing with git

I was wondering if the strategy I m using for tagging and hotfixing tags (which then I use for deploying rails applications) with git is appropriate. For tagging I just tag a commit of the master ...

Tips on upgrading CVS to git/hg?

We still use CVS, I use git and hg for my personal use though I m still a novice at both, but I realize they re much more modern and better, faster, distributed, etc. It s just everyone is so ...

Using Git in a TFS shop

Using Git at home has spoiled me - I now find using TFS at work to be a bit of a drag and want to explore the possibility of using Git locally and syncing somehow with TFS. I figure there are a few ...