Capistrano deployment with password

I'm trying out Rubymine 4.5 RC and trying to run Capistrano but having a problem. I have a guess what might be wrong:

Normally, when I run it from the command line, it asks me for a password for the git repo. When I run it in Rubymine I get the following:

  * executing `deploy:update_code'
    updating the cached checkout on all servers
    executing locally: "git ls-remote git@github.com:MY-REPO.git development"
*** [deploy:update_code] rolling back
  * executing "rm -rf /path/to/project/releases/20120711214917; true"
    servers: ["MY-SERVER.com"]
Password: stty: stdin isn't a terminal
stty: stdin isn't a terminal

So, is there a way to enter a password here?

0
4 comments

Hello, Paul

I think that here are the settings you can help. You can add it to the deploy.rb:

set :repository, "git@github.com:user/repo.git"  # Your clone URL
set :scm, "git"
set :user, "deployer"  # The server's user for deploys
set :scm_passphrase, "p@ssw0rd"  # The deploy user's password



Please write us if not help.

0
Avatar
Permanently deleted user

Hi Anna,

Thanks for your quick response. I didn't want to put the passphrase in the file itself because that file is checked into source control. I can work around that easily by putting the password in a file and reading it in. However, when I did that, I still got the prompt like before. I realized that I can still type at that point, and typed in the passphrase. (Note that when I run this on the command line, I have to enter the password at three different places.) That got me to this message:

[MY-SERVER.com] executing command
    command finished in 171ms
/Users/ME/.rvm/gems/ruby-1.9.3-p194/gems/capistrano-2.12.0/lib/capistrano/recipes/deploy.rb:107:in ``': No such file or directory - git ls-remote git@github.com:MY-PROJECT.git development (Errno::ENOENT)

Since I get a 404 from github when I try to go to my repo without logging in, I think that is probably the problem: it isn't logging in.

There is probably a different way to set up my deploy.rb file. Do you have a sample deploy.rb that works? (Preferably including RVM and a private git repo?)

0

Sorry for the delay in answer, was a lot of work before release RubyMine 4.5 :)
We have not support of tty, but we have the feature request in bugtracker, you can vote for it RUBY-11576.  So, you should use console to deploy to private repository.
I have only a public reprository in github and have used instruction from here. Hope it helps for you.

0

Hi Paul,

Are you authorising by a straight username/password or is it an ssh session with a passphrase on the certificate?

If it's the latter, I long since gave up trying to reliably get capistrano to co-operate with a passphrase.  I had some success using a local keyserver and preauthorising the key before starting cap, but network traffic would sometimes make the preauthorisation time out.

I tried a completely different method.

  • I created an account on my local machine that held nothing but a mirror repository.
  • I then created a new ssh certificate specifically for that account with no passphrase.  It's extra important to make sure that no-one else gets the key involved in that connection: ensure that all permissions at set correctly (chmod 0600 basically) and treat the 'public' key as you would normally the 'private' key.
  • I set capistrano to perform it's clone from the mirror rather than github.


This method worked very well for me because I was on a fixed ip address, I imagine it would not be so easy if you're on a dynamic ip address.

I hope that might give you a little help. ...or at the very least give you some ideas to try.

Kind regards,
Geoff

0

Please sign in to leave a comment.