简体   繁体   English

为什么我无法克隆我作为协作者的私有存储库

[英]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 操作的令牌认证要求”。

Dec, 2021 Update: 2021 年 12 月更新:

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

This is how you generate a token:这是您生成令牌的方式:

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.

相关问题 我无法从 GitLab 克隆存储库 - I am not able to clone repository from GitLab 我正在尝试克隆一个私有存储库,但它说未找到存储库? - I am trying to clone a private repo but it says Repository not found? 如果我是 Github 上某人存储库的合作者,我如何将他们的存储库放到我的终端上? - If I am a collaborator on someone's repository on Github, how do I get their repo onto my terminal? 当我在代理下时,为什么不能克隆此GitHub存储库? - Why I can't clone this GitHub repository when I am under a proxy? 为什么我在 git clone 上询问密码? - Why i am asking password on git clone? 考虑到两者都在本地计算机上,为什么我不能将其从本地存储库推送到远程存储库? - Why am I not able to push from a local repository to a remote repository, given that both are on my local machine ? 显示我是个人资料的贡献者的存储库 - Display a repository of which I am contributor on profile 为什么我不能通过 GIT 克隆私有存储库? - Why can't I clone a private repository via GIT? 为什么我可以只用我的用户名和 email 推送到克隆的私有仓库? - Why am I able to push to a cloned private repo with just my username and email? 未添加为合作者的用户能够推送/拉入私有 GitHub 存储库 - User not added as collaborator is able to push/pull to private GitHub repository
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM