我一直试图在heroku上引入一些经过验证的git repos,并遇到了一些问题.
理想情况下,我希望能够在此使用令牌解决 方案,如果令牌解决方案不是,则git pull https://<token>@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
Run Code Online (Sandbox Code Playgroud)
将较新版本的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 …
Run Code Online (Sandbox Code Playgroud)