`git clone` access with an installation token?


#1

I’m attempting to run git clone with an installation token, but not having success. Things work fine with an OAuth token.

The Git Access section says:

Ask for Repository contents permission and use your installation token to authenticate via HTTP-based Git

I’ve asked for read-only permissions to contents:

…but when I attempt to clone, I get an error:

git clone https://[TOKEN REMOVED]:x-oauth-basic@github.com/scoutapp/[REPO]
Cloning into '[REPO]'...
remote: Invalid username or password.
fatal: Authentication failed for 'https://[TOKEN REMOVED]:x-oauth-basic@github.com/scoutapp/[REPO]/'

I’ve tried using the prompts as well for username/pw and inserting [TOKEN REMOVED] as the username - no luck.

I’m able to read repo contents just fine via the API.

Is cloning possible with an installation token?


Update docs on git usage with oauth tokens
#2

Hey @itsderek23,

Cloning is possible with the installation token, but just the format needs a tweak - we decided to not allow these tokens as the HTTP username, but instead as the password, for improved security. Sorry that wasn’t clear from the start.

Enter your token instead of the password, and just the String x-access-token in place of the HTTP username, like so:

git clone https://x-access-token:[TOKEN REMOVED]@github.com/scoutapp/[REPO]

Let us know if you have any other issues. We’ll update the docs to include this info for Integrations.


#3

Great - confirmed that works. Thanks!


#4