![](/img/trans.png)
[英]SSH Authentication fails when running Capistrano cap production deploy
[英]Running cap production deploy and bitbucket
我在將軌道代碼上的 ruby 部署到 mac 上的數字海洋時遇到此錯誤。 我使用這個命令
cap production deploy
解決方案對我不起作用:
1- 重置 bitbucket 密碼
2-將 ssh 密鑰添加到 bitbucket
3-更改為設置:repo_url,“git@bitbucket.org:BorrowUp/borroupapi.git”
這是我在終端上得到的
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@159.65.65.203: git exit
status: 128
git stdout: Nothing written
git stderr: remote: Invalid username or password
fatal: Authentication failed for 'https://BorrowUp@bitbucket.org/BorrowUp/borroupapi.git/'
Caused by:
SSHKit::Command::Failed: git exit status: 128
git stdout: Nothing written
git stderr: remote: Invalid username or password
fatal: Authentication failed for 'https://BorrowUp@bitbucket.org/BorrowUp/borroupapi.git/'
Tasks: TOP => deploy:check => git:check
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing as deploy@159.65.65.203: git
exit status: 128
git stdout: Nothing written
git stderr: remote: Invalid username or password
fatal: Authentication failed for 'https://BorrowUp@bitbucket.org/BorrowUp/borroupapi.git/'
這里是錯誤日志/capistrano.log
INFO ---------------------------------------------------------------------------
INFO START 2020-07-06 08:47:55 -0700 cap production deploy
INFO ---------------------------------------------------------------------------
DEBUG [7a8c66fd] Running [ -d $HOME/.rbenv/versions/2.4.1 ] as deploy@159.65.65.203
DEBUG [7a8c66fd] Command: [ -d $HOME/.rbenv/versions/2.4.1 ]
DEBUG [7a8c66fd] Finished in 0.717 seconds with exit status 0 (successful).
INFO [d39093e5] Running /usr/bin/env mkdir -p /tmp as deploy@159.65.65.203
DEBUG [d39093e5] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.4.1" ;
/usr/bin/env mkdir -p /tmp )
INFO [d39093e5] Finished in 0.131 seconds with exit status 0 (successful).
DEBUG Uploading /tmp/git-ssh-borroup-production-amerbearat.sh 0.0%
INFO Uploading /tmp/git-ssh-borroup-production-amerbearat.sh 100.0%
INFO [b1e7fe5a] Running /usr/bin/env chmod 700 /tmp/git-ssh-borroup-production-
amerbearat.sh as deploy@159.65.65.203
DEBUG [b1e7fe5a] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.4.1" ;
/usr/bin/env chmod 700 /tmp/git-ssh-borroup-production-amerbearat.sh )
INFO [b1e7fe5a] Finished in 0.145 seconds with exit status 0 (successful).
INFO [e19dbc60] Running /usr/bin/env git ls-remote
https://BorrowUp@bitbucket.org/BorrowUp/borroupapi.git HEAD as deploy@159.65.65.203
DEBUG [e19dbc60] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.4.1"
GIT_ASKPASS="/bin/echo" GIT_SSH="/tmp/git-ssh-borroup-production-amerbearat.sh" ;
/usr/bin/env git ls-remote https://BorrowUp@bitbucket.org/BorrowUp/borroupapi.git HEAD )
DEBUG [e19dbc60] remote: Invalid username or password
DEBUG [e19dbc60] f
DEBUG [e19dbc60] atal:
DEBUG [e19dbc60] A
DEBUG [e19dbc60] uthentication failed for '
DEBUG [e19dbc60] h
DEBUG [e19dbc60] ttps://BorrowUp@bitbucket.org/BorrowUp/borroupapi.git/
DEBUG [e19dbc60] '
這是 deploy.rb
lock "~> 3.14.1"
set :application, "borroup"
set :repo_url, "https://BorrowUp@bitbucket.org/BorrowUp/borroupapi.git"
set :deploy_to, "/home/deploy/borroupapi"
set :ssh_options, { forward_agent: true }
set :linked_files, %w{config/database.yml config/secrets.yml}
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
execute :touch, release_path.join('tmp/restart.txt')
end
end
after :publishing, 'deploy:restart'
after :finishing, 'deploy:cleanup'
end
namespace :deploy do
after :restart, :clear_cache do
on roles(:web), in: :groups, limit: 3, wait: 10 do
end
end
end
這是 git 配置文件
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = https://BorrowUp@bitbucket.org/BorrowUp/borroupapi.git
fetch = +refs/heads/*:refs/remotes/origin/*
更改為
set:repo_url, "git@bitbucket.org:BorrowUp/borroupapi.git"
這不是deploy.rb
顯示的。
只要你看到 HTTPS URL,再多的 SSH 修修補補都行不通。
你可以試試
git config url.git@bitbucket.org:.insteadOf https://BorrowUp@bitbucket.org/
然后測試這是否會向右推 URL。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.