我在一个带有python:3
映像的Docker容器中(在Gitlab /CD管道中)运行以下内容。我使用以下命令安装了git:
apt-get update
apt-get install -y git
根据输出,这甚至没有必要,因为git已经安装好了。不幸的是,我得到了以下输出,即即使在脚本前面使用了"git“命令,也找不到"git”命令。有人知道这是怎么回事吗?
$ apt-get update
Get:1 http://security.debian.org/debian-security bullseye-security InRelease [44.1 kB]
Get:2 http://deb.debian.org/debian bullseye InRelease [116 kB]
Get:3 http://deb.debian.org/debian bullseye-updates InRelease [39.4 kB]
Get:4 http://security.debian.org/debian-security bullseye-security/main amd64 Packages [109 kB]
Get:5 http://deb.debian.org/debian bullseye/main amd64 Packages [8183 kB]
Get:6 http://deb.debian.org/debian bullseye-updates/main amd64 Packages [2592 B]
Fetched 8494 kB in 1s (6639 kB/s)
Reading package lists...
$ apt-get install -y git
Reading package lists...
Building dependency tree...
Reading state information...
git is already the newest version (1:2.30.2-1).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
$ git --version
git version 2.30.2
$ git config --global user.email "${GIT_USER_EMAIL:-$GITLAB_USER_EMAIL}"
$ git config --global user.name "${GIT_USER_NAME:-$GITLAB_USER_NAME}"
$ regex="^report\/[^\/]*\/([^\/]*)\/(.*)"
$ [[ $CI_COMMIT_BRANCH =~ $regex ]]
$ CUSTOMER="${BASH_REMATCH[1]}"
$ PATH="${BASH_REMATCH[2]}"
$ RELPATH=$(.ci/scripts/find_relative.py "${CI_PROJECT_PATH}" "${PATH}")
$ git submodule add ${RELPATH} ${CUSTOMER}
/scripts-530-146123/step_script: line 151: git: command not found
ERROR: Job failed: command terminated with exit code 1
发布于 2022-01-20 17:01:18
在这一行:
PATH="${BASH_REMATCH[2]}"
您可以更改PATH
变量。我怀疑在新的路径中不再有/usr/bin
(或git
所在的任何地方)。
https://stackoverflow.com/questions/70790287
复制相似问题