git-lfs:找不到命令

问题描述 投票:0回答:1

这是我的 GitLab 阶段和脚本:-

stages:
  - lfs

lfs:
  stage: lfs
  image: python:3.9
  script:
    - echo "running lfs clean up"
    - git --version
    - python --version
    - pip3 install --upgrade pip
    - pip3 install git-lfs

根据作业日志,已安装 git-lfs,但当我尝试打印版本时,它说找不到命令。这是日志参考:-

$ git --version
git version 2.39.2
$ python --version
Python 3.9.18
$ pip3 install --upgrade pip
Requirement already satisfied: pip in /usr/local/lib/python3.9/site-packages (23.0.1)
Collecting pip
  Downloading pip-23.2.1-py3-none-any.whl (2.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 24.0 MB/s eta 0:00:00
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 23.0.1
    Uninstalling pip-23.0.1:
      Successfully uninstalled pip-23.0.1
Successfully installed pip-23.2.1
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
$ pip3 install git-lfs
Collecting git-lfs
  Downloading git_lfs-1.6-py2.py3-none-any.whl (5.6 kB)
Installing collected packages: git-lfs
Successfully installed git-lfs-1.6
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
$ git-lfs --version
/usr/bin/bash: line 142: git-lfs: command not found
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 1
git gitlab gitlab-ci gitlab-ci-runner
1个回答
3
投票

您安装的没有任何入口点,因此您无法像这样从终端使用它。

相反,您必须使用:

$ python3 -m git_lfs

但我怀疑你很可能不想这样做,而你实际上想要

git-lfs
。要将其安装在
python:3.9
容器中,您可以使用:

$ apt-get update -y; apt-get upgrade -y
$ apt-get install git-lfs
$ git-lfs --version
git-lfs/3.3.0 (GitHub; linux amd64; go 1.19.8)
© www.soinside.com 2019 - 2024. All rights reserved.