Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 2
Message 1 of 2

Cloning private repo with a Github App private key

Solved! Go to Solution.

Hello!

 

I was wondering if it is possible to clone a private repository using a Github App private key.

 

Is it possible?

If so, do you know which permissions it requires to do so?

 

I tried giving it "Contents" read-only permissions, but it still cannot clone it...

 

The way I test it is by using:

ssh-agent bash -c 'ssh-add {{private_key_file.pem}}; git clone git@github.com:{{username}}/{{repo}}.git'
1 Reply
Highlighted
Solution
Ground Controller Lvl 1
Message 2 of 2

Re: Cloning private repo with a Github App private key

Did you find a solution?

 

I am trying to clone private repositories with my Github App aswell.

 

I just found a way that works for me using the command line.

 

https://developer.github.com/apps/building-github-apps/authenticating-with-github-apps/ at the very bottom

 

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

 

I am retrieving a user token using a POST request to https://api.github.com/app/installations/$installationId/access_tokens.