繁体   English   中英

在heroku上引入经过身份验证的git repos

[英]Pulling in authenticated git repos on heroku

我一直试图在heroku上引入一些经过验证的git repos,并遇到了一些问题。

理想情况下,我希望能够在这里使用令牌解决方案 git pull https://<token>@github.com/username/bar.git甚至是git pull https://username:password@github.com/username/bar.git如果令牌解决方案不是,则可以使用git pull https://username:password@github.com/username/bar.git解决方案。

但是,似乎heroku版本的git(v1.7.0)与https认证克隆相悖:

$ heroku run bash
$ git --version
git version 1.7.0
$ git clone https://username:password@github.com/username/bar.git
Initialized empty Git repository in /app/bevry-website/.git/
error: The requested URL returned error: 401 while accessing https://username:password@github.com/username/bar.git/info/refs
fatal: HTTP request failed

将较新版本的git(v1.7.12)安装到heroku实例上并使用它可以正常工作:

$ heroku run bash
$ curl --silent --location http://git-core.googlecode.com/files/git-1.7.12.tar.gz | tar xz; cd git-1.7.12; make NO_TCLTK=YesPlease NO_PERL=YesPlease NO_GETTEXT=YesPlease NO_SVN_TESTS=YesPlease NO_MSGFMT=YesPlease NO_MSGFMT_EXTENDED_OPTIONS=YesPlease prefix=$HOME install; cd ..; rm -Rf git-1.7.12
$ ./bin/git --version
git version 1.7.12
$ ./bin/git clone https://username:password@github.com/username/bar.git
works fine :)

但是,在实例上安装我们自己的git版本并不理想,因为编译和安装需要很长时间。

似乎heroku不提供任何免费支持,这是不幸的,因为我只需要告诉他们升级他们的git版本,一切都很好。 但是,由于这是不可能的,有没有人有任何建议在heroku上进行经过身份验证的https git克隆? (我已经设法通过使用repo上传一个特殊的.ssh目录来获得经过身份验证的ssh,但这对我们的情况并不理想,因为我们更喜欢使用https和令牌)。

如果git版本确实是1.7.0,那么它太旧了,因为从那时起已经完成了多次修复http传输机制。
(如1.11.7:如果服务器配置为匿名允许GET,同时要求对POST进行身份验证,则使用最近的Git推送到智能HTTP服务器失败而没有URL中的用户名强制进行身份验证。)

Plus 1.7.8引入了一种缓存凭证的方法:

处理“ git push ”和“ git fetch ”中使用的HTTP事务的用户名/密码的代码学会了将“凭证API”与外部程序进行对话以缓存或存储它们,以允许与平台本机密钥链机制集成。

你的ssh解决方法是一种方法,重新编译git另一种方法,但在heroku升级其默认git之前,我没有看到另一种方法来安全地使用https进行Heroku git repos身份验证。

我刚才遇到了同样的问题:

$ git clone https://username:password@github.com/username/bar.git
Initialized empty Git repository in /app/bevry-website/.git/
error: The requested URL returned error: 401 while accessing https://username:password@github.com/username/bar.git/info/refs
fatal: HTTP request failed

我使用电子邮件作为Github的用户名。 Heroku的git(版本1.7)不支持此功能。

git clone https://username:password@github.com/username/bar.git

如果您使用实际的Github用户名而不是您的电子邮件,它可以工作。

电子邮件作为新的Git版本的用户名。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM