当防火墙阻止 git 时如何安装 DevStack

当防火墙阻止 git 时如何安装 DevStack

我一直在关注https://docs.openstack.org/developer/devstack/但总是错误:

...
[Call Trace]
./stack.sh:718:git_clone
/opt/stack/devstack/functions-common:538:git_timed
/opt/stack/devstack/functions-common:602:die
[ERROR] /opt/stack/devstack/functions-common:602 git call failed: [git clone git://git.openstack.org/openstack/requirements.git /opt/stack/requirements --branch master]
Error on exit
./stack.sh: line 506: generate-subunit: command not found
stack@DevStack:~/devstack$

因此我手动尝试了最后一个命令(git clone git://git.openstack.org/openstack/requirements.git /opt/stack/requirements --branch master)并得到:

Cloning into '/opt/stack/requirements'...
fatal: unable to connect to git.openstack.org:
git.openstack.org[0: 104.130.246.128]: errno=Connection timed out
git.openstack.org[1: 2001:4800:7819:103:be76:4eff:fe06:63c]: errno=Network is unreachable

我认为这是由于使用git://而不是http://因为当我尝试替换它时,我得到:

stack@DevStack:~/devstack$ git clone http://git.openstack.org/openstack/requirements.git /opt/stack/requirements --branch master
Cloning into '/opt/stack/requirements'...
remote: Counting objects: 18929, done.
remote: Compressing objects: 100% (9696/9696), done.
remote: Total 18929 (delta 12803), reused 15154 (delta 9213)
Receiving objects: 100% (18929/18929), 2.83 MiB | 2.79 MiB/s, done.
Resolving deltas: 100% (12803/12803), done.
Checking connectivity... done.
stack@DevStack:~/devstack$

我猜这是因为我身处公司防火墙的限制之下。那么如何让安装脚本使用 http 而不是 git?

答案1

在克隆的存储库中编辑228 行stackrc文件中。您可以轻松地用git://替换https://

答案2

好吧,我很确定这不是最好的方法,但是可以结合以下答案:

我过去常常用grep -rlnw '/opt/stack/' -e 'git:' | xargs -i@ sed -i 's/git:/http:/g' @来替换。git://http://

但是,由于安装过程中会不断下载更多文件git://,因此我需要在安装过程中同时运行此程序,以便在下载新文件时进行替换:

watch -n 1 grep -rlnw '/opt/stack/' -e 'git:' | xargs -i@ sed -i 's/git:/http:/g' @

相关内容