Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Ground Controller Lvl 1
Message 1 of 7

Clone private repo

Solved! Go to Solution.

HI all,

 

How can I clone a private repo?

 

Thanks.

6 Replies
Solution
Copilot Lvl 3
Message 2 of 7

Re: Clone private repo

Hi @jurajbgh, there are two main ways to accompilsh this, the first is authenticating with SSH - you can read GitHub's articles to help you with setting this up, however, it's more advanced.

 

The second way is using HTTPS and providing your username and password in the URL. For example if I was cloning a public repository I might use:

git clone https://github.com/strafe/project.git

but if the repository was private then I'd use:

git clone https://strafe:mygithubpassword@github.com/strafe/project.git

 

Please note if you use 2FA to secure your GitHub account then you'll need to use a personal access token instead of your password, this article explains how to.

Ground Controller Lvl 1
Message 3 of 7

Re: Clone private repo

Thanks, Problem fixed.

Ground Controller Lvl 1
Message 4 of 7

Re: Clone private repo

Hi, might be possible that authentication fails when using HTTPS and providing your username and password in the URL in case the password contains special chars (case example:  p@ssword )? 

Thanks.

Ground Controller Lvl 1
Message 5 of 7

Re: Clone private repo

If you have a special character in your password, replace it with values from this website https://support.brightcove.com/special-characters-usernames-and-passwords case example: p@ssword --> p%40ssword

Ground Controller Lvl 1
Message 6 of 7

Re: Clone private repo

I got this message: fatal: protocol 'git clone https' is not supported.  Not sure why...

Highlighted
Ground Controller Lvl 1
Message 7 of 7

Re: Clone private repo

For anyone else reading, know that using the

git clone https://myusername:mygithubpassword@github.com/myusername/project.git

way of doing things will cause your password to be written into the repo you just cloned in several different places, most notably the remote url.  Do not do this if you are planning to share access to your clone with anyone!