[英]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.我是一个私人 github 存储库的合作者。 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?是只有我还是 github 实际上不允许克隆私人仓库,即使我是其中的合作者?
You can clone it over HTTPS
您可以通过HTTPS
克隆它
git clone https://github.com/privateRepo/privateRepo.git
The prompt will ask for your username password/Authentication Token.提示将询问您的用户名密码/身份验证令牌。
or或者
git clone https://username:token@github.com/user/repo
Note :- Support for password authentication was removed [link] .注意:- 删除了对密码身份验证的支持[链接] 。 Please use a personal access token instead of password if it does not work.如果不起作用,请使用个人访问令牌而不是密码。
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.确保使用PAT(个人访问令牌)作为您的密码,而不是您实际的 GitHub 帐户密码。
This is because of " Token authentication requirements for Git operations " from Dec. 2020.这是因为从 2020 年 12 月开始的“ Git 操作的令牌认证要求”。
You neet to use Personal Access Token(PAT) to clone a private repository .您需要使用个人访问令牌 (PAT) 来克隆私有存储库。
This is the syntax of the command to clone a private repository with personal access token below:这是使用以下个人访问令牌克隆私有存储库的命令的语法:
* token is personal access token . *令牌是个人访问令牌。
git clone https://<username>:<token>@github.com/<username>/<reponame>.git
1, Go to "Settings" : 1、进入“设置” :
2, Scroll down then go to "Developer settings" : 2,向下滚动然后转到“开发人员设置” :
3, Press "Personal access tokens" then press "Generate new token" : 3、按“个人访问令牌”然后按“生成新令牌” :
4, Fill "Note" then check "repo" : 4、填写“Note”然后勾选“repo” :
* If "repo" is not checked, you cannot clone a private repository. *如果未选中“repo” ,则无法克隆私有存储库。
5, Scroll down then press "Generate token" : 5、向下滚动然后按“生成令牌” :
6, Finally, a token(Personal access token) is generated: 6、最后生成一个token(Personal access token) :
This is the command with the token generated above :这是带有上面生成的令牌的命令:
git clone https://<username>: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@github.com/<username>/<reponame>.git
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.