Anjali
Anjali

Reputation: 163

Why am I not able to clone a private repository in which I am a collaborator

I am a collaborator in one the private github repository. I am able to fork it but when I try to clone it onto my system, it shows a pop up box asking for credentials and even if I enter correct credentials I can't login.

Is it just me or github actually doesn't allow cloning of private repo even if I am a collaborator in it?

Upvotes: 10

Views: 35401

Answers (4)

Juliana Auzier
Juliana Auzier

Reputation: 31

If you have access to the repo, you can do this in 5 steps:

  1. Copy the "https" to clone, go to git bash and enter:

2: git config --global user.name "yourUserGit"

3: git config --global user.password "yourPasswordGit"

4: git clone "https://github.com/user/repoName.git"

5: cd repoName

And be happy :)

Upvotes: 0

Mustafa SDET
Mustafa SDET

Reputation: 61

I had the similar problem and realized that I am mistakenly adding an unnecessary <username> into the command.

Solution:

We should have or create personal access token. You can refer creating a personal access token link to create one. And the command should be:
git clone https://<personal_access_token>@github.com/<your account or organization>/<repo>.git

Be careful

I was mistakenly adding an extra <username> which is not seen in the repository link. We should simply use the repository link which already includes account user name or organization name.

For a repository link something like this https://github.com/mustafasdet/python.git, we should simply put personal_access_token after https://. And here is the command:

git clone https://[email protected]/mustafasdet/python.git

Upvotes: 2

Shailesh Suryawanshi
Shailesh Suryawanshi

Reputation: 1270

You can clone it over HTTPS

git clone https://github.com/privateRepo/privateRepo.git

The prompt will ask for your username password/Authentication Token.

or

git clone https://username:[email protected]/user/repo

Note :- Support for password authentication was removed [link]. Please use a personal access token instead of password if it does not work.

Upvotes: 7

VonC
VonC

Reputation: 1328602

If you can fork it, you should be albe to clone it.

even if I enter correct credential

Make sure to use a PAT (Personal Access Token) as your password, instead of your actual GitHub account password.
This is because of "Token authentication requirements for Git operations" from Dec. 2020.

Upvotes: 0

Related Questions