Github clone with oauth access token

 git - Github clone with oauth access token - Stack Overflow

Easier builds and deployments using Git over HTTPS and OAuth | The GitHub Blog

If you’re cloning inside a script and need to avoid the prompts, you can add the token to the clone URL:

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

or

git clone https://<token>:x-oauth-basic@github.com/owner/repo.git

Note: Tokens should be treated as passwords. Putting the token in the clone URL will result in Git writing it to the .git/config file in plain text. Unfortunately, this happens for HTTP passwords, too. We decided to use the token as the HTTP username to avoid colliding with credential helpers available for OS XWindows, and Linux.

To avoid writing tokens to disk, don’t clone. Instead, just use the full git URL in your push/pull operations:

mkdir foo
cd foo
git init
git pull https://<token>@github.com/username/bar.git


I turned out to be a scope issue. I of course needed full repo scope since I was trying to clone a private repository.

It's a shame Github does not have some clearer error messages for these kind of things, but security wise I understand why.

For anyone trying to figure out what is wrong when trying out something like this, I would suggest to create a personal access token with full access to everything:

settings > developer settings > personal access tokens > generate new token

This way you can easily test if it is a scope issue by comparing your token with a personal access token that has access rights for everything.

Thanks for anyone who still took the time to read this.


Just use the HTTPS address to clone with the key as the user, so:

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

asdasd asd as

Không có nhận xét nào:

Cold Turkey Blocker

 https://superuser.com/questions/1366153/how-to-get-rid-of-cold-turkey-website-blocker-get-around-the-block Very old question, but still wan...