【问题标题】:Push to several FTP servers推送到多个 FTP 服务器
【发布时间】:2021-03-02 20:22:17
【问题描述】:

所以我有一个 gitlab 存储库,当前每次提交时它都会与 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

对多台服务器执行此操作的最佳方法是什么?谢谢

【问题讨论】:

    标签: git gitlab yaml gitlab-ci sftp


    【解决方案1】:

    请参阅https://github.com/git-ftp/git-ftp/blob/master/man/git-ftp.1.md 上的文档。您可以直接推送到 URL:

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

    您也可以尝试利用scopes

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-01-27
    • 2011-06-07
    • 2015-10-04
    • 2023-01-26
    • 2014-10-23
    • 1970-01-01
    • 2023-04-01
    相关资源
    最近更新 更多