2016-05-26 1 views
2

Je vais avoir 3 serveurs:crochet post-gitlab ce hôte de réception vérification de la clé n'a pas

werkstation.example.com -> server where the gitlab repository is cloned & for changing the files fom the repository 
git.example.com -> gitab server with repository "tomcat" 
docker.example.com -> server where the files will be copied with git hook 

Mon crochet git:

#!/bin/sh 

read oldrev newrev refname 

REPO="[email protected]:michaelv1234/tomcat.git" 
BRANCH=`echo $refname | sed -n 's/^refs\/heads\///p'` 
BRANCH_DIR="/home/michael" 
SSH_DEST="[email protected]" 

## 
# Instantiate the branches on the puppetmaster 
if [ "$newrev" -eq 0 ] 2> /dev/null; then 
     # branch is being deleted 
     echo "Deleting remote branch $SSH_DEST $BRANCH_DIR/$BRANCH" 
     echo "$SSH_DEST" /bin/sh 
     ssh "$SSH_DEST" /bin/sh <<-EOF 
       cd "$BRANCH_DIR" && rm -rf $BRANCH 
     EOF 
else 
     # branch is being updated 
     echo "Updating remote branch $SSH_DEST $BRANCH_DIR/$BRANCH" 
     ssh "$SSH_DEST" /bin/sh <<-EOF 
       { cd "$BRANCH_DIR/$BRANCH" || mkdir -p "$BRANCH_DIR/$BRANCH" && cd "$BRANCH_DIR/$BRANCH"; } \ 
       && { git fetch origin && git reset --hard origin/$BRANCH || { git clone "$REPO" ./ && git checkout $BRANCH; }; } 
     EOF 
fi 

Mais je reçois toujours cette erreur:

[email protected]:~/tomcat$ git push -u origin master 
Counting objects: 5, done. 
Compressing objects: 100% (2/2), done. 
Writing objects: 100% (3/3), 254 bytes | 0 bytes/s, done. 
Total 3 (delta 1), reused 0 (delta 0) 
remote: Updating remote branch [email protected] /home/michael/master 
remote: Host key verification failed. 
To [email protected]:michaelv1234/tomcat.git 
0032c02..6e8ef97 master -> master 
Branch master set up to track remote branch master from origin. 

J'ai déjà supprimé le fichier "known_hosts" sur tous les serveurs mais je reçois toujours l'erreur

+0

Juste pour le test, dans votre crochet git, pouvez-vous 'unset GIT_DIR'? – VonC

+0

oui je peux annuler GIT_DIR –

+0

Cela a-t-il changé quelque chose? – VonC

Répondre

0

Les clés SSH de docker.example.com ont-elles changé?

Vous recevez l'erreur remote: Host key verification failed. car la clé hôte SSH de la machine docker.example.com ne correspond pas à la clé contenue dans le fichier known_hosts sur git.example.com.

Recherchez dans la machine git.example.com les fichiers known_hosts et vérifiez s'ils contiennent une entrée pour docker.example.com. Si vous trouvez une entrée, supprimez et réessayez l'opération (ou bien exécutez ssh-keygen -R docker.example.com >> /path/to/known_hosts pour mettre à jour la clé pour cet hôte).

+0

Non les clés SSH n'ont pas changé –