Git Repositories

Correct the problem to identify to another repository with multiple ssh keys.
authorCyrille Pontvieux <jrd@enialis.net>
Tue, 18 Nov 2014 19:07:26 +0000 (19:07 +0000)
committerCyrille Pontvieux <jrd@enialis.net>
Tue, 18 Nov 2014 19:07:26 +0000 (19:07 +0000)
homegit/gitrepo.sh
src/repo-edit.php

index 1f41ddb..98f28e6 100755 (executable)
@@ -33,7 +33,7 @@ Action is one of:
  - fetch Name Url
    Fetch all remotes if the Url is in Name.git/fetchurls file
  - export Name on|off
-   Export (or not) the following repo as read-only for git-daemon
+   Export (or not) the following repo as read-only for git-daemon and git-http-backend
  - sync Name from|to url
    Synchronize from or to the following URL.
    Sync to is done automatically at each commit. Be careful to add git user ssl keys to remote repo.
@@ -375,7 +375,18 @@ EOF
     chmod +x "$NAME".git/hooks/post-update
     mkdir -p "$NAME".git/hooks/.post-update.d
   fi
-  echo "git push --quiet $HOST &" > "$NAME".git/hooks/.post-update.d/$HOST
+  if [ ! -f "$NAME".git/.sshwrapper ]; then
+    cat <<'EOF' > "$NAME".git/.sshwrapper
+ssh \
+  -o UserKnownHostsFile=/dev/null \
+  -o StrictHostKeyChecking=no \
+  -o LogLevel=ERROR \
+  -i $(dirname "$0")/id_rsa \
+  "$@"
+EOF
+    chmod +x "$NAME".git/sshwrapper
+  fi
+  echo 'GIT_SSH=$(readlink -f $(dirname "$0")/../../.sshwrapper) git push --quiet'" $HOST &" > "$NAME".git/hooks/.post-update.d/$HOST
   chmod +x "$NAME".git/hooks/.post-update.d/$HOST
 }
 
index d6b9c70..fbeb8c3 100644 (file)
@@ -126,7 +126,7 @@ require('header.inc.php');
           <input type="submit" name="submit_repo_syncto_add" value="Ajouter l'URL"/>
         </fieldset>
       </form>
-      <div class="invite">Deploy key :</div>
+      <div class="invite">Clé de déploiement :</div>
 <?php
   if (file_exists("$gitdir/$repo.git/id_rsa.pub")) {
     $deploy = file_get_contents("$gitdir/$repo.git/id_rsa.pub");