git-ssh.howto (2076B)
1 Git + SSH HOWTO 2 =============== 3 4 License notice 5 -------------- 6 7 Copyright (c) 2022 Strahinya Radich. 8 Permission is granted to copy, distribute and/or modify this document 9 under the terms of the GNU Free Documentation License, Version 1.3 10 or any later version published by the Free Software Foundation; 11 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. 12 A copy of the license is included in the file LICENSE. 13 14 15 Making git work with dropbear 16 ----------------------------- 17 18 By default, Galeb uses dropbear as a SSH server/client. Since it uses a 19 different configuration and calling conventions than other ssh implementations, 20 it is necessary to make a few adjustments, which are specific enough to not be 21 included in Galeb by default. 22 23 24 Wrapper and environment 25 ----------------------- 26 27 The ssh executable can be specified in git through the GIT_SSH environment 28 variable. However, since dropbear uses a different calling convention than 29 usual, it is necessary to create a wrapper shell function or a shell script. 30 For example: 31 32 /local/bin/gitssh 33 ----8<---snip--->8--------8<---snip--->8--------8<---snip--->8---- 34 #!/bin/sh 35 36 error() 37 { 38 printf "%s: %s\n" "${0##*/}" "$*" >&2 39 } 40 41 case $1 in 42 *github.com*) key=~/.ssh/github;; 43 *sr.ht*) key=~/.ssh/srht;; 44 *) error Unknown host 45 exit 1;; 46 esac 47 48 dbclient -i ${key} $* 49 ----8<---snip--->8--------8<---snip--->8--------8<---snip--->8---- 50 51 You should adjust case patterns and SSH key locations for your setup. You can 52 then edit /etc/profile: 53 54 /etc/profile 55 ----8<---snip--->8--------8<---snip--->8--------8<---snip--->8---- 56 GIT_SSH=/local/bin/gitssh 57 export GIT_SSH 58 ----8<---snip--->8--------8<---snip--->8--------8<---snip--->8---- 59 60 61 Converting OpenSSH keys 62 ----------------------- 63 64 Dropbear doesn't use PEM format used by OpenSSH and other SSH variants. 65 Instead, to use existing keys it is necessary to convert them to Dropbear 66 format using dropbearconvert: 67 68 $ dropbearconvert openssh dropbear ~/.ssh/github-openssh ~/.ssh/github 69 70