[英].gitlab-ci.yml Gitlab Deploy SFTP Not Working
deploy:
stage: deploy
script:
- apt-get update -qq && apt-get install -y -qq lftp
#- lftp -u $DEPLOY_USER,$SFTP_PASSWORD $DEPLOY_HOST -e "mirror -e -R -p ./dist/ new/ ; quit"
- lftp -c "set ftp:ssl-allow no; debug; open -u root,$DEPLOY_PASSWORD -p 22 $DEPLOY_HOST; mirror -Rev ./ gitlab --verbose --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/"
- echo "deployment complete"
# specify environment this job is using
environment:
name: staging
url: https://xxxxxxxx.de/
# needs artifacts from previous build
Why does the preceding .gitlab-ci.yml
create the following error?为什么前面的.gitlab-ci.yml
产生以下错误?
new Fail ->新的失败->
--verbose --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/"
---- Running connect program (ssh -a -x -s -l root xx.xx.xxx.xx sftp)
---> sending a packet, length=5, type=1(INIT), id=0
<--- The authenticity of host 'xx.xx.xxx.xx (xx.xx.xxx.xx)' can't be established.
<--- ECDSA key fingerprint is SHA256:xxxxxxxxxxxxxxx+xxxxxxxxxxxxxx.
<--- Are you sure you want to continue connecting (yes/no)? no
<---
<--- Host key verification failed.
---- Disconnecting
---- Running connect program (ssh -a -x -s -l root xx.xx.xxx.xx sftp)
---> sending a packet, length=5, type=1(INIT), id=0
<--- The authenticity of host 'xx.xx.xxx.xx (xx.xx.xxx.xx)' can't be established.
<--- ECDSA key fingerprint is SHA256:xxxxxxxxxxxxxxxxxxxxxx+xxxxxxxxxxxxx.
<--- Are you sure you want to continue connecting (yes/no)? no
<---
<--- Host key verification failed.
mirror: Fatal error: Host key verification failed.
---- Disconnecting
ERROR: Job failed: exit code 1
You have set ftp:ssl-allow no
, but you are connecting to port 22 which is most likely an SSL service.您已设置ftp:ssl-allow no
,但您正在连接端口 22,这很可能是 SSL 服务。
Assuming you intend to use SSL for the connection.假设您打算使用 SSL 进行连接。 Try: set ftp:ssl-allow true;
尝试: set ftp:ssl-allow true;
as part of the lftp command.作为 lftp 命令的一部分。
The lftp man page states: lftp 手册页指出:
ftp:ssl-allow (boolean) if true, try to negotiate SSL connection with FTP server for non-anonymous access. ftp:ssl-allow (boolean) 如果为真,尝试与 FTP 服务器协商 SSL 连接以进行非匿名访问。 Default is true.默认为真。 This and other SSL settings are only available if lftp was compiled with an ssl/tls library.此设置和其他 SSL 设置仅在 lftp 使用 ssl/tls 库编译时才可用。
lftp -c "set ftp:ssl-allow no; debug; open -u root,$DEPLOY_PASSWORD -p 22 $DEPLOY_HOST…" lftp -c "set ftp:ssl-allow no; debug; open -u root,$DEPLOY_PASSWORD -p 22 $DEPLOY_HOST..."
1st, remove set ftp:ssl-allow no;
1、删除set ftp:ssl-allow no;
or set it to yes
.或将其设置为yes
。
2nd, you said "SFTP" in the title and use port 22;第二,您在标题中说“SFTP”并使用端口 22; protocol SFTP is not FTP, it's a completely different protocol;协议 SFTP不是FTP,它是一个完全不同的协议; to use it you've to make lftp
to use the protocol by using URL with sftp://
protocol:要使用它,您必须通过使用带有sftp://
协议的 URL 使lftp
使用该协议:
lftp -c "debug; open -u root,$DEPLOY_PASSWORD sftp://$DEPLOY_HOST…"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.