0

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 ?

user85005
  • 87
  • 2
  • 7

2 Answers2

1

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
  • 18,495
  • 2
  • 40
  • 51
0

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
  • 4,976
  • 2
  • 18
  • 11
  • /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 ? – user85005 Jan 02 '10 at 08:54
  • 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 Jan 02 '10 at 17:23
  • when I log as 'git' user (with disable password) and do ssh://git@192.168.0.6/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 ? – user85005 Jan 02 '10 at 17:49
  • 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 Jan 02 '10 at 18:53