Git 使用 HTTPS 访问私有(private)仓库

标签 git git-clone

尝试使用 HTTPS 协议(protocol)克隆我有权访问的私有(private)存储库,因为它只允许传出流量。

git 不要求输入密码,只是失败了。

error: The requested URL returned error: 403 Forbidden while accessing https://github.com/blah/blahblah.git/info/refs

我错过了什么?

最佳答案

您是否尝试在克隆 URL 中插入用户名(和可选的密码)?

 git clone https://username@github.com/blah/blahblah.git

或者如果您接受将密码存储在普通 View 中的后果:

 git clone https://username:password@github.com/blah/blahblah.git

看到这个线程有很多有用的信息:

How to provide username and password when run "git clone git@remote.git"?

编辑:我原来的答案只是一个快速修复,没有了解提问者的完整历史,它也可以在无人值守的情况下工作,但为了最佳安全实践,最好让 Git 存储您的密码。参见@phpguru 的回答:https://stackoverflow.com/a/29018371/257090

关于Git 使用 HTTPS 访问私有(private)仓库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24008982/

相关文章:

Git push : The object is 12311134 byte, 大于此存储库中对象的 1048576 字节限制

git - 设置 Git 远程 SSH (git-upload-pack/git-receive-pack)

git - 机器人/蜘蛛会克隆公共(public) git 存储库吗?

git - 错误 : src refspec master does not match any. 无法将某些引用推送到 heroku

git - 如何在 Github 中将单独的 pull 请求与 "stacking"相互叠加?

github 问题 - 错误 : failed to push some refs

Git 克隆除一个文件或文件夹之外的所有文件,可能吗?

git - 如何手动下载使用Git大文件存储的项目大文件?

c++ - 使用 SourceTree 克隆 GitHub 上的公共(public)存储库

Git 记录到某个提交