I want to use Git over SSH with my Linode VPS running Ubuntu 10.04 LTS.
Instructions seem pretty easy, infact given I had already setup my SSH key etc..
All I had to do was instruct my local repository to send to the server
ssh://[email protected]:22/~/mygits/proj1.git
Problem is when I do git push origin master it just stall, no network activity, no errors, after a few minutes I kill it with ctrl+c. I sent along time yesterday try to diagnosis the problem. So on the server I setup a new user matt2 and copied authorized_keys across to matt2 and tried pushing to [email protected]:22 and viola it worked.
What are differences between matt and matt2? Well matt has this in his .bash_profile to ensure an ssh-agent is running (i need this func alot):
#Start/Reuse SSH Agent - restart or re-use an existing agent
SSH_AGENT_CACHE=/tmp/ssh_agent_eval_`whoami`
if [ -s "${SSH_AGENT_CACHE}" ]
then
echo "Reusing existing ssh-agent"
eval `cat "${SSH_AGENT_CACHE}"`
# Check that agent still exists
kill -0 "${SSH_AGENT_PID}" 2>-
if [ $? -eq 1 ]
then
echo "ssh-agent pid ${SSH_AGENT_PID} no longer running"
# Looks like the SSH-Agent has died, it'll be restarted below
rm -f "${SSH_AGENT_CACHE}"
fi
fi
if [ ! -f "${SSH_AGENT_CACHE}" ]
then
echo "Starting new ssh-agent"
touch "${SSH_AGENT_CACHE}"
chmod 600 "${SSH_AGENT_CACHE}"
ssh-agent >> "${SSH_AGENT_CACHE}"
chmod 400 "${SSH_AGENT_CACHE}"
eval `cat "${SSH_AGENT_CACHE}"`
ssh-add
So it appears my .bash_profile conflicts with the operating of git over SSH. Any suggestions of workarounds, I dont want to use 2 user accounts, and I want to keep my .bash_profile. It would be good if I could edit the .bash_profile and wrap the functionality around if [ $connectingWith != "git-client"] but I doubt such thing exists?
Thoughts?