How to avoid ssh passphrase while using git on bluehost
I'm using assembla as git repository. I want to keep a local version to my bluehost hosting. each time i ask to fetch the latest copy, it ask me to put passphrase -
Enter passphrase for key '/h开发者_如何转开发ome/xxx/.ssh/id_dsa':
How can i avoid this? One more thing, if i add a command on cron for git as below
cd /path/to/project.git && git fetch -q
it tells
/bin/sh: git: command not found
How to solve this too?
BTW, i'm trying to figure this for my redmine tool. Thanks Musa Musa
You have to use a SSH-agent that will store the deciphered key in memory.
This is really easy under unix, just launch eval $(ssh-agent)
and then ssh-add
this will ask you for your password and then store the key.
For the cron problem, try entering the full path, you can obtain it with which git
on any shell.
You can have a look at keychain which takes care of starting ssh-agents as needed. From the rpm package description:
Keychain is a manager for OpenSSH, ssh.com, Sun SSH and GnuPG agents. It acts as a front-end to the agents, allowing you to easily have one long-running agent process per system, rather than per login session. This dramatically reduces the number of times you need to enter your passphrase from once per new login session to once every time your local machine is rebooted.
You need to add your public key to ~/.ssh/authorized_keys on BlueHost. See http://ionrails.com/2009/08/29/bluehost-login-to-your-ssh-account-without-typing-in-a-password/ for more info. I also remember finding this in the user forums for BlueHost
I can not verify this firsthand since I have just been cut and pasting the passphrase when I do a git pull.
Here's a link which tells you exactly how to do this:
http://linuxconfig.org/passwordless-ssh
Take note of the first comment. I needed to substitute the scp command just as that commenter suggested.
精彩评论