【问题标题】:Capistrano deploy fails for repo that was moved from github to private git.. stil trying to contact github.. why?Capistrano 部署从 github 转移到私有 git 的 repo 失败 .. 仍然试图联系 github .. 为什么?
【发布时间】:2017-01-09 09:46:38
【问题描述】:

我有一个 Rails 4 项目,它从 github 开始,然后被移动到一个私有 git 存储库。我可以完美地使用 repo(推送、克隆)。我在代码中的某处搜索了对 github 存储库的引用,但不存在。它一定与 GIT 以及存储库的启动方式有关。..

重要提示:在我删除 github 之前,我能够从我的私人仓库中使用此配置进行部署。

当然我已经更新了 config/deploy.rb

set :repo_url, '/srv/git/project.git'

运行“git remote -v”:

origin  git@git.server:/srv/git/project.git (fetch)
origin  git@git.server:/srv/git/project.git (push)

capistrano 运行“bundle exec cap production deploy”的日志:

00:00 git:wrapper
      01 mkdir -p /tmp
server's password:
    ✔ 01 server 6.019s
00:07 git:check
      01 git ls-remote --heads /srv/git/project.git
      01 6b0c9f5ad2d8e768902c5da1509fd99915068295       refs/heads/master
    ✔ 01 server 0.356s
00:07 deploy:check:directories
      01 mkdir -p /home/user/applications/project/shared /home/user/applications/project/releases
    ✔ 01 user@server 0.335s
00:08 deploy:check:linked_dirs
      01 mkdir -p /home/user/applications/project/shared/public/assets
    ✔ 01 user@server 0.331s
00:09 git:clone
      The repository mirror is at /home/user/applications/project/repo
00:10 git:update
      01 git remote update --prune
      01 Fetching origin
      01 remote: Invalid username or password.
      01 fatal: Authentication failed for 'https://github.com/user/project.git/'
      01 error: Could not fetch origin

不久前从 SVN 迁移到 GIT,对这种行为有点困惑.. 感谢任何帮助!

【问题讨论】:

  • 如何获得如此简短且用户友好的 capistrano 日志?

标签: ruby-on-rails git github capistrano


【解决方案1】:

您必须更改服务器上的来源。完成此操作的最简单方法可能是通过 SSH 连接到服务器,导航到 /home/user/applications/project/repo 并:

git remote set-url origin /srv/git/project.git

我不相信 capistrano 会自动更新遥控器。

【讨论】:

  • 就是这样.. 我不知道 Capistrano 在那里保留了存储库的克隆:我相信它在每次从 url 中的 repo 复制时从头开始克隆它.. 谢谢跨度>
  • 与增量相比,在每次部署时下载整个存储库将花费大量时间。
猜你喜欢
  • 2016-09-06
  • 2012-05-07
  • 1970-01-01
  • 1970-01-01
  • 2014-03-21
  • 2018-10-06
  • 2014-05-09
  • 2021-02-14
  • 2016-10-30
相关资源
最近更新 更多