gitlab - 无法在 gitlab 公共(public)运行器上通过 LFTP 连接到远程 FTP 服务器

标签 gitlab lftp runner ionos

我在 Ionos.com 上有一个 FTP 服务器,它与 Filezilla 配合良好。 但是,当我尝试通过 gitlab 公共(public)运行程序(节点:最新图像)上的 LFTP 连接到此 FTP 服务器时,我不断收到错误,具体取决于我在做什么:

连接端口 21:

lftp -d -e "set ftp:ssl-allow no;set ssl:verify-certificate false;set sftp:auto-confirm no;ls;" -u 'xxx','xxx' -p 21 'xxx'

---- Resolving host address...
---- 2 addresses found: xxx, xxx
---- Connecting to xxx (xxx) port 21
**** Socket error (Network is unreachable) - reconnecting
---- Closing control socket
---- Connecting to xxx (xxx) port 21
<--- 220 FTP Server ready.
---> FEAT
<--- 500 'FEAT': command unrecognized.
---> USER xxx
<--- 331 Password required for xxx
---> PASS xxx
<--- 530 Login incorrect.
---> PWD
ls: Login failed: 530 Login incorrect.
<--- 421 Service not available, closing control connection.
---> QUIT
<--- 530 Not logged in.
---- Closing control socket

连接端口 22:

lftp -d -e "set ftp:ssl-allow yes;set ssl:verify-certificate true;set sftp:auto-confirm yes;ls;" -u 'xxx','xxx' -p 22 'xxx'

---- Resolving host address...
---- 1 address found: xxx
---- Connecting to xxx (xxx) port 22
<--- SSH-2.0-OpenSSH_7.9p1 Debian-10+deb10u1~ui10+2
**** Peer closed connection
---- Closing control socket

最后 4 行循环得令人作呕。

我已经通过在 Filezilla 上测试凭据和服务器主机来检查凭据和服务器主机是否良好。

有人可以帮助我吗? 谢谢

最佳答案

我花了一段时间才使其正常工作,这是我的解决方案:

deploy:
  script:
    - apt-get update -qq && apt-get install -y -qq lftp
    - mkdir ~/.ssh/
    - ssh-keyscan -t rsa homexxxxxxx.1and1-data.host >> ~/.ssh/known_hosts
    - lftp -d -e "set ftp:ssl-allow yes;set ssl:verify-certificate true;set sftp:auto-confirm yes;ls;" -u $USERNAME,$PASSWORD -p 22 'sftp://homexxxxxxx.1and1-data.host' -e "mirror -e -R -x .git -p ./ ; quit"
  only:
    - master

如果没有 ssh-keyscan -t rsa homexxxxxxx.1and1-data.host >> ~/.ssh/known_hosts 行,gitlab 运行程序将返回 主机 key 验证失败 错误。

关于gitlab - 无法在 gitlab 公共(public)运行器上通过 LFTP 连接到远程 FTP 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65093387/

相关文章:

git - 如何在 gitlab 中更改现有 merge 请求的源分支?

Gitlab runner 无法使用来自 ~/.docker/config.json 的凭据进行身份验证

Gitlab CI 无法连接到服务

lftp - 如何使用lftp列出本地文件

ftp - 未知命令 - LFTP

api - 如何在newman中运行来自集合的单个请求

java - 我的 Runner 使用 Handler 无法在 Android 上运行

java - 激活 Gitlab 以构建项目并运行测试的 .gitlab-ci.yml 文件应该是什么?

Homebrew 在 macOS Sierra 上找不到 LFTP 公式

java - 在 Junit 中扩展 ParentRunner