Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Satis - specify SSH key to git server

Tags:

ssh-keys

satis

I have a satis.json file specified like so:

{
    "name": "My organizations Satis Server",
    "homepage": "http://satis.mydomain.org",
    "repositories": [
        {
            "type": "vcs",
            "url": "[email protected]:/home/git/packages/MyPackage",
            "options": {
                "ssh2": {
                    "username": "git",
                    "pubkey_file": "/config/public-key.pub",
                    "privkey_file": "/config/private-key"
                }
            }
        },
        ...

I then try to get satis to update by running the command:

/usr/bin/php /path/to/satis/satis -n build /path/to/satis.json /path/to/location

This will completely ignore the fact that I have specified the public key file and the private key file and continue to ask me for a password. If I manually plug in the password each time it works. If I move the ssh keys to .ssh/id_rsa and .ssh/id_rsa.pub and remove the options parameters then it also works.

Question

How do I correctly specify the key file for each repo so that I can use different keys for different repositories, rather than relying on one key in .ssh/id_rsa

like image 669
Programster Avatar asked Nov 10 '22 11:11

Programster


1 Answers

As a workaround, I have managed to get by with setting the $HOME/.ssh/config file (Nixcraft reference) for all of the hosts in the satis.json file like so:

Host git.mydomain.org
     HostName git.mydomain.org
     User git
     Port 22
     IdentityFile /path/to/private-key

Host git.mySecondDomain.org
     HostName git.mySecondDomain.org
     User git
     Port 22
     IdentityFile /path/to/private-key2

My satis.json file now looks like:

{
    "name": "My organizations Satis Server",
    "homepage": "http://satis.mydomain.org",
    "repositories": [
        {
            "type": "vcs",
            "url": "[email protected]:/home/git/packages/MyPackage"
        },
        {
            "type": "vcs",
            "url": "[email protected]:/home/git/packages/SecondPackage"
        },
        ...

This is rather inelegant and I am hoping that there is still a way to specify the path to the key to use in the satis.json file.

like image 192
Programster Avatar answered Dec 04 '22 05:12

Programster