views:

271

answers:

2

I have an autodeploy bash script to get updated repo to /tmp in 'post-receive' hook on gitosis

#!/bin/bash

PWD=$PWD

REPO_NAME=${PWD##/*/}

cd /tmp

git clone git@atom-desktop:$REPO_NAME

But anytime when I push repository I got error like this:

Host key verification failed.

fatal: The remote end hung up unexpectedly error: hooks/post-receive exited with error code 128

How to cope with that ?

A: 

Sounds like there is a key mismatch in the SSH connection from wherever /tmp is and atom-desktop. What happens if you try to SSH from the machine that /tmp is located at to atom-desktop?

Mike
/tmp folder is located on atom-desktop, if I try to do 'touch sample_file' in the same post-receive script, it is created by 'git' user as a file owner without any problem, I though this may be key mismatch, but how to fix that ?
This is why I said "what happens if you SSH". The error should give you an indication as to what you need to do. If it does not, try removing ~/.ssh/known_hosts. That is where public key fingerprints are stored.
Mike
when I log as 'git' user (with disable password) and do ssh://[email protected]/home/git/repositories/myproject,I am asked about password, but when i do the same from other pc in local network, it works without prompting, maybe I should add 'git' user rsa pub key somewhere ?
Sounds like you have set up passwordless SSH, but not on the machine you need it to work from. See here for a very quick tutorial one how to set it up (I forget every time!): http://blogs.translucentcode.org/mick/archives/000230.html
Mike
+1  A: 

You can simply do:

git clone --local $REPO_NAME

As git also supports cloning from local directories: git-clone

For local respositories, also supported by git natively, the following syntaxes may be used:

/path/to/repo.git/

file:///path/to/repo.git/

These two syntaxes are mostly equivalent, except the former implies --local option.

tommasop