简体   繁体   中英

Running cap production deploy and bitbucket

im getting this error while deploying ruby on rails code to digital ocean on mac. I use this command

cap production deploy

Solution did not work for me:

1- reset bitbucket password

2- add ssh key to bitbucket

3- changing to set:repo_url, "git@bitbucket.org:BorrowUp/borroupapi.git"

here is what i get on the terminal

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/'

here the error log/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]  '   

here is 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

here is git config file

[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/*

changing to set:repo_url, "git@bitbucket.org:BorrowUp/borroupapi.git"

This is not what deploy.rb shows.

As long as you see HTTPS URL, no amount of SSH tinkering will work.

You might try a

git config url.git@bitbucket.org:.insteadOf https://BorrowUp@bitbucket.org/

To test if this would push to the right URL then.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM