Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connecting to github repo from server: success for 1-9, error for 10 only #7

Open
buffler opened this issue May 27, 2016 · 4 comments

Comments

@buffler
Copy link

buffler commented May 27, 2016

First of all, this is an awesome sanity checker - thank you tons for providing it!

I keep running into the following error when running bundle exec cap staging deploy:

Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I have a feeling this is going to end up being an issue on my end, not yours, but: have you ever seen numbers 1-9 succeed but 10 still fail, when trying to connect to a Github repo from a staging server? Here's the output when running bundle exec cap staging ssh:doctor:

SSH agent forwarding report
---------------------------
1. [success] `repo_url` setting ok
2. [success] ssh private key file exists
3. [success] `ssh-agent` process seems to be running locally
4. [success] `ssh-agent` process recognized by `ssh-add` command
5. [success] ssh private keys added to `ssh-agent`
6. [success] application repository accessible from local machine
7. [success] all hosts using passwordless login
8. [success] `forward_agent` ok for all hosts
9. [success] ssh agent successfully forwarded to remote hosts
10. [error] It seems Capistrano cannot access application git repository from these hosts:
ssh.phx.nearlyfreespeech.net
Actions:
- make sure all the previous checks pass. That should make this one work too.

This happens when using the format

set :repo_url, '[email protected]:{github-organization}/{private-repo}.git'

in my deploy.rb. When using either

set :repo_url, 'https://{github-username}:{github-password}@github.com/{github-organization}/{private-repo}.git'

or

set :repo_url, 'https://{github-oauth-token}:@github.com/{github-organization}/{private-repo}.git'

, I am able to successfully connect to the Github repo from the staging server - but those are less than ideal as (I think) they'd require putting Github credentials of some sort in the repo.

I'm admittedly not super strong re: ssh-agent, forwarding, etc. so I'm sure there are a few things I could be missing. I am encouraged to know that having checks 1-9 pass should make 10 work too, but perplexed as to what else might be causing check 10 to fail. Thanks for any insight/assistance you may be able to provide!

@buffler buffler changed the title success for 1-9, error for 10 only connecting to github repo from server: success for 1-9, error for 10 only May 27, 2016
@buffler
Copy link
Author

buffler commented May 30, 2016

I've set this up currently so that my Github oauth token is in a separate, gitignored file, which is then required in my Capistrano deploy.rb file to put the repo_url together. So, I can now successfully deploy to our staging server without including sensitive information in the repo.

I'd still like to find out why I can't use the [email protected]:{github-organization}/{private-repo}.git format for :repo_url, with keys, when all of the SSH forwarding report's requirements seem to be met. If you need further info from me just let me know - and thanks again for any help!

@marthesselink
Copy link

I'm having exactly the same issue, only thing is that I'm using gitlab.com istead of github.
Also is @buffler temporary fix not working for me:

[6656b180] remote: HTTP Basic: Access denied DEBUG [6656b180] fatal: Authentication failed for 'https://OAUTH:@gitlab.com/NAME/NAME.git/'

[cce6eb0e] fatal: unable to access 'https://NAME:PASSWORD/[email protected]/NAME/NAME.git/': Couldn't resolve host 'NAME'

@NanoMeko
Copy link

NanoMeko commented Oct 7, 2021

Same issue with set :repo_url, '[email protected]:{github-organization}/{private-repo}.git'

1. [success] `repo_url` setting ok

2. [success] ssh private key file exists

3. [success] `ssh-agent` process seems to be running locally

4. [success] `ssh-agent` process recognized by `ssh-add` command

5. [success] ssh private keys added to `ssh-agent`

6. [success] application repository accessible from local machine

7. [success] all hosts using passwordless login

8. [success] `forward_agent` ok for all hosts

9. [success] ssh agent successfully forwarded to remote hosts

10. [error] It seems Capistrano cannot access application git repository from these hosts:

Actions:
- make sure all the previous checks pass. That should make this one work too.

@besi
Copy link

besi commented Sep 14, 2022

I had some weird issues like this. As soon as I used bundler i.e. bundle exec cap staging deploy it no longer prompted me for a ssh password and continued to work again.

See here https://stackoverflow.com/questions/73713317/capistrano-3-asks-for-ssh-users-password-since-do-release-upgrade-was-done-on

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants