Answer the question
In order to leave comments, you need to log in
How to fix access error using Capistrano?
From my computer on Win I write cap producion deploy
, the application should work on ip 000.000.000.003, and on 000.000.000.002 GitLab, on both CentOS 6
Capistrano files
# Файл deploy.rb
lock "~> 3.11.0"
set :application, "nameproject"
set :repo_url, "http://000.000.000.002/root/nameproject.git"
set :password, "****"
# Путь на где хранится проект
set :deploy_to, "/var/www/nameproject/data/www/nameproject"
task :dev do
on "[email protected]" do #
execute "node #{release_path}/index.js"
end
end
after "deploy:cleanup", :dev #
# Файл production.rb # Но по существу это должен быть dev.rb
server "000.000.000.003", user: "username", password: "****", roles: %w{app web}
PS D:\путь к проекту> cap production deploy
00:00 git:wrapper
01 mkdir -p /tmp
✔ 01 [email protected] 10.899s
Uploading /tmp/git-ssh-nameproject-production-winusr.sh 100.0%
02 chmod 700 /tmp/git-ssh-nameproject-production-winusr.sh
✔ 02 [email protected] 0.421s
00:11 git:check
01 git ls-remote http://000.000.000.002/root/nameproject.git HEAD
01 remote: HTTP Basic: Access denied
01 fatal: Authentication failed for 'http://000.000.000.002/root/nameproject.git/'
#<Thread:[email protected]:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sshkit-1.17.0/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sshkit-1.17.0/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sshkit-1.17.0/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as [email protected]: git
exit status: 128 (SSHKit::Runner::ExecuteError)
git stdout: Nothing written
git stderr: remote: HTTP Basic: Access denied
fatal: Authentication failed for 'http://000.000.000.002/root/nameproject.git/'
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as [email protected]: git exit status: 128
git stdout: Nothing written
git stderr: remote: HTTP Basic: Access denied
fatal: Authentication failed for 'http://000.000.000.002/root/nameproject.git/'
Caused by:
SSHKit::Command::Failed: git exit status: 128
git stdout: Nothing written
git stderr: remote: HTTP Basic: Access denied
fatal: Authentication failed for 'http://000.000.000.002/root/nameproject.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 [email protected]: git exit status: 128
git stdout: Nothing written
git stderr: remote: HTTP Basic: Access denied
fatal: Authentication failed for 'http://000.000.000.002/root/nameproject.git/'
** DEPLOY FAILED
** Refer to log/capistrano.log for details. Here are the last 20 lines:
INFO [24577c0e] Finished in 0.861 seconds with exit status 0 (successful).
INFO [cb0a2907] Running /usr/bin/env git ls-remote http://000.000.000.002/root/nameproject.git HEAD as [email protected]
DEBUG [cb0a2907] Command: ( export GIT_ASKPASS="/bin/echo" GIT_SSH="/tmp/git-ssh-nameproject-production-winusr.sh" ; /usr/bin/env git ls-remote http://000.000.000.002/root/nameproject.git
HEAD )
DEBUG [b9fda019] remote: HTTP Basic: Access denied
fatal: Authentication failed for 'http://000.000.000.002/root/nameproject.git/'
INFO ---------------------------------------------------------------------------
INFO START 2018-09-19 13:45:48 +0300 cap production deploy
INFO ---------------------------------------------------------------------------
INFO [a8fe0d90] Running /usr/bin/env mkdir -p /tmp as [email protected]
DEBUG [a8fe0d90] Command: /usr/bin/env mkdir -p /tmp
INFO [fc9791c0] Finished in 10.899 seconds with exit status 0 (successful).
DEBUG Uploading /tmp/git-ssh-nameproject-production-winusr.sh 0.0%
INFO Uploading /tmp/git-ssh-nameproject-production-winusr.sh 100.0%
INFO [1b17c9c5] Running /usr/bin/env chmod 700 /tmp/git-ssh-nameproject-production-winusr.sh as [email protected]
DEBUG [1b17c9c5] Command: /usr/bin/env chmod 700 /tmp/git-ssh-nameproject-production-winusr.sh
INFO [a7a946fa] Finished in 0.421 seconds with exit status 0 (successful).
INFO [1c1909ea] Running /usr/bin/env git ls-remote http://000.000.000.002/root/nameproject.git HEAD as [email protected]
DEBUG [1c1909ea] Command: ( export GIT_ASKPASS="/bin/echo" GIT_SSH="/tmp/git-ssh-nameproject-production-winusr.sh" ; /usr/bin/env git ls-remote http://000.000.000.002/root/nameproject.git
HEAD )
DEBUG [2f23f4d6] remote: HTTP Basic: Access denied
fatal: Authentication failed for 'http://000.000.000.002/root/nameproject.git/'
Answer the question
In order to leave comments, you need to log in
Since I myself am new to this, I am writing the answer as for beginners.
For a long time I tried to do something with passwords, wasp accounts, but all this is not right.
From the log, it is important to understand that there is a request from the test server (where the application is) http://000.000.000.003/ to the server with GitLab with the repository http://000.000.000.002/ and he wants to log in to the GitLab account and not to the account in the OS . I also noticed a mention of SSH.
In general, I stopped doing everything through passwords. I began to deal with SSH, read about it here https://losst.ru/avtorizatsiya-po-klyuchu-ssh . In general, you need to generate it and then add it in the GitLab panel in the account settings.
In the Capistrano config, I changed the external_url link to SSH type (you can copy it on the repository page in GitLab) I
went to the test server 000.000.000.003, through remote access so that I could copy the text.
I ran the command to generate keys, I just pressed Enter, I didn’t enter anything
We need a public one, it was generated here, open it
Copy the contents of the file and paste it into GitLab in
and press the "Add key" button
Done. The deployment step with authorization in the remote repository must be completed.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question