5

我有一个这样指定的 satis.json 文件:

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

然后我尝试通过运行以下命令来满足更新:

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

这将完全忽略我已指定公钥文件和私钥文件并继续要求我输入密码的事实。如果我每次工作时手动插入密码。如果我将 ssh 键移动到.ssh/id_rsa.ssh/id_rsa.pub删除选项参数,那么它也可以工作。

问题

如何正确指定每个 repo 的密钥文件,以便我可以为不同的存储库使用不同的密钥,而不是依赖于一个密钥.ssh/id_rsa

4

2 回答 2

1

作为一种解决方法,我设法为 satis.json 文件中的所有主机设置$HOME/.ssh/config文件(Nixcraft 参考),如下所示:

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

我的 satis.json 文件现在看起来像:

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

这是相当不雅的,我希望仍然有一种方法可以指定要在satis.json文件中使用的密钥的路径。

于 2015-06-15T18:39:39.867 回答
0

在构建静态存储库时,使用-n开关来使用 $HOME/.ssh 文件夹中当前用户可用的公共 ssh 密钥。

于 2016-01-21T17:09:47.580 回答