Satis - specify SSH key to git server

3.5k views Asked by At

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

2

There are 2 answers

0
Programster On BEST ANSWER

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.

0
kuvukala On

When building static repository use -n switch to use public ssh keys available for your current user in $HOME/.ssh folder.