DEV Community

Cover image for How to get Clone a private Github repo!?
‪Karim Negm‬‏
‪Karim Negm‬‏

Posted on

How to get Clone a private Github repo!?

Hello all, this is my first post on community

I had a simple problem with git clone a private repo to my desktop, I tried many commands from StackOverflow and other websites and issues from GitHub, and nothing my issue not solved

today I solved my problem and want to share my solution with you

everything is about the access token to get access now,

Create Personal Access Token on Github

From your Github account, go to Settings => Developer Settings => Personal Access Token => Generate New Token (Give your password) => Fillup the form => click Generate token => Copy the generated Token, it will be something like ghp_sFhFsSHhTzMDreGRLjmks4Tzuzgthdvfsrta

after that in your command type

https://<PERSONAL-ACCESS-TOKEN><user_name"the owner user name " >/<repo_name>.git

that's it, your repo will get cloned correctly and without any disruptions

I hope you will find my post is Interesting and if you have any comments feel free to comment or commit;)

Discussion (1)

chuniversiteit profile image
Chun Fei Lung

This works!

Alternatively, you can use SSH keys. They’re a bit safer, as you don’t end up with secrets (your personal access token) in your history.

Windows/macOS users who are looking for a really easy solution can just use the GitHub Desktop client to clone private GitHub repositories (you can still use git for other Git operations if you prefer the CLI).