gpt4 book ai didi

git - Capistrano 无法使用 SSH pull Stash 存储库

转载 作者:行者123 更新时间:2023-12-02 14:21:33 25 4
gpt4 key购买 nike

我遵循以下程序:

  • 创建了一个 SSH key ;
  • 在 Atlassian Stash 中启用 SSH;
  • 为名为 Capistrano 的 Stash 帐户添加了 SSH key (Capistrano 已使用用户名和密码成功连接到 Stash)
  • 使用命令 git clone ssh://git@stash.domain.com:7999/project/repository.git 测试了 SSH 连接并且成功克隆了存储库;
  • 将以下行更改为 config/deploy.rb在 Capistrano 项目目录中:set :repo_url, 'ssh://git@stash.domain.com:7999/project/repository.git'

  • 问题是执行命令 cap production git:check我收到以下错误行并且部署被取消:
    INFO [8b21e06e] Running /usr/bin/env mkdir -p /tmp/capistrano_project_name/ as deploy@host.domain.com
    DEBUG [8b21e06e] Command: /usr/bin/env mkdir -p /tmp/capistrano_project_name/
    INFO [8b21e06e] Finished in 0.292 seconds with exit status 0 (successful).
    DEBUG Uploading /tmp/capistrano_project_name/git-ssh.sh 0.0%
    INFO Uploading /tmp/capistrano_project_name/git-ssh.sh 100.0%
    INFO [376577ce] Running /usr/bin/env chmod +x /tmp/capistrano_project_name/git-ssh.sh as deploy@host.domain.com
    DEBUG [376577ce] Command: /usr/bin/env chmod +x /tmp/capistrano_project_name/git-ssh.sh
    INFO [376577ce] Finished in 0.036 seconds with exit status 0 (successful).
    INFO [2ed5c706] Running /usr/bin/env git ls-remote --heads ssh://git@stash.domain.com:7999/project/repository.git as deploy@host.domain.com
    DEBUG [2ed5c706] Command: ( GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/capistrano_project_name/git-ssh.sh /usr/bin/env git ls-remote --heads ssh://git@stash.domain.com:7999/project/repository.git )
    DEBUG [2ed5c706] Permission denied (publickey).
    DEBUG [2ed5c706] fatal: Could not read from remote repository.
    DEBUG [2ed5c706]
    DEBUG [2ed5c706] Please make sure you have the correct access rights
    DEBUG [2ed5c706] and the repository exists.
    (Backtrace restricted to imported tasks)
    cap aborted!
    Exception while executing as deploy@host.domain.com: git exit status: 128
    git stdout: Nothing written
    git stderr: Permission denied (publickey).
    fatal: Could not read from remote repository.

    Please make sure you have the correct access rights
    and the repository exists.

    Tasks: TOP => git:check
    (See full trace by running task with --trace)

    我已经尝试简单地将变量更改为 set :repo_url, 'ssh://git@stash.domain.com:7999/project/repository.git'但我收到同样的错误。
    有人通过 SSH 成功地将 Capistrano 连接到 Stash 吗?
    您能否建议我如何调试它?我想避免在我的 Capistrano 配置文件中使用用户名和密码。

    最佳答案

    一个简单的答案,但我猜 Capistrano 选错了 key 。我建议您检查部署用户的默认 ssh key 。因此,如果 capistrano 设置为使用 deployuser 登录服务器,看什么键deployuser拿起。使用 ssh -T git@stash.domain.com -p 7999 进行测试可能会有所帮助看看会发生什么。

    关于git - Capistrano 无法使用 SSH pull Stash 存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30643397/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com