簡體   English   中英

使用capistrano部署失敗-致命:HTTP請求失敗。 在設置為bitbucket時請求github

[英]Deploying with capistrano fails - fatal: HTTP request failed. Requesting github, when set to bitbucket

因此,我已經在Capistrano上部署了一段時間。 一切都很好。 最近,我遇到了一些問題。

這個過程很簡單。 我有一個bitbucket帳戶。 我將推送到那里,然后用cap提取遠程倉庫,然后將其推送到遠程服務器。 這樣,在使用cap deploy ,將提示我兩次輸入密碼; 實際上,我什至不知道為什么它兩次要求我輸入密碼( 所以也許可以對此有所了解 )。 盡管如此,它工作了很長時間,然后隨機停止了工作。 在第二次請求密碼時,現在說的是fatal: HTTP request failed

讓事情變得更加混亂的是,我查看了整個過程,它在第二個密碼提示之后而不是bitbucket上github請求回購。 曾經有一段時間我使用github,但這是過去的事情。 因此,我在Capfile和deploy.rb中尋找了對github存儲庫的引用,但沒有找到任何引用。

這在哪里,為什么要提出要求? 我怎樣才能解決這個問題?

作為參考,這是我的deploy.rb(當然刪除了敏感信息):

set :application, "Application"
set :deploy_to, "/home/user/apps/app"
set :password, "webhostpassword"
set :user, "webhostuser"
set :domain, "webhostip"
set :deploy_via, :remote_cache
set :use_sudo, false 
set :scm, :git
set :repository,  "https://username@bitbucket.org/account/app.git"
set :scm_username, "repousername"
set :scm_passphrase, "repopassword"

ssh_options[:forward_agent] = true

role :web, domain                           # Your HTTP server, Apache/etc
role :app, domain                           # This may be the same as your 'Web' server
role :db,  domain, :primary => true  

default_run_options[:pty] = true

namespace :deploy do
 task :start do ; end
 task :stop do ; end
 task :restart, :roles => :app, :except => { :no_release => true } do
  run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
 end
end

這里是失敗的輸出:

servers: ["webhostip"]
[webhostip] executing command
** [webhostip :: out] Password:
Password:
** [webhostip :: out]
** [webhostip :: out] error: The requested URL returned error: 403 Forbidden
while accessing https://repo@github.com/repo/app.git/info/refs
**
** fatal: HTTP request failed
←[2;37mcommand finished in 18881ms←[0m

注意第6行和第7行在詢問密碼后正在訪問github的位置(這是使用cap deploy時第二次出現密碼提示

以我的猜測,如果遠程服務器上已經存在回購,則capistrano將執行git pull origin <branch>而不是git clone <repo url> 因此,它仍在嘗試訪問github url。

您可以通過檢查遠程服務器上的.git/config文件來驗證這一點。 或通過運行git remote -v命令。 如果origin指向githubbitbucket更改為bitbucket 然后手動運行git pull origin master命令以確保其正常工作

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM