Git 推送到多个FTP服务器

Git 推送到多个FTP服务器,git,gitlab,yaml,gitlab-ci,sftp,Git,Gitlab,Yaml,Gitlab Ci,Sftp,因此,我有一个gitlab repo,它当前在我每次提交时都与SFTP服务器同步。现在,我有了另一个SFTP服务器,我也必须将文件推送到该服务器,但我不确定该如何自动执行此操作。这是我现在拥有的yml脚本: stages: - push - notification push: stage: push image: debian:stable before_script: - apt-get update -y --allow-unauthenticated

因此,我有一个gitlab repo,它当前在我每次提交时都与SFTP服务器同步。现在,我有了另一个SFTP服务器,我也必须将文件推送到该服务器,但我不确定该如何自动执行此操作。这是我现在拥有的yml脚本:

stages:
  - push
  - notification

push:
  stage: push
  image: debian:stable
  before_script:
    - apt-get update -y --allow-unauthenticated
    - apt-get install -y git git-ftp --allow-unauthenticated
    
    - git config http.sslVerify "false"
    - git config --global http.sslVerify "false"
    - git config git-ftp.url "sftp://$FTP_URL/$FTP_PATH"
    - git config git-ftp.user "$FTP_USER"
    - git config git-ftp.password "$FTP_PASSWORD"
  script:
   - git ftp push -v --insecure
对多台服务器执行此操作的最佳方法是什么?谢谢

请参阅上的文档。您可以直接推送到URL:

git ftp push -u username2 -p password2 -- "sftp://$FTP_URL2/$FTP_PATH2"

您也可以尝试利用。

非常感谢,这worked@jamesberg