我有一个像这样指定的 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"
}
}
},
...
Run Code Online (Sandbox Code Playgroud)
然后我尝试通过运行以下命令来让 satis 更新:
/usr/bin/php /path/to/satis/satis -n build /path/to/satis.json /path/to/location
Run Code Online (Sandbox Code Playgroud)
这将完全忽略我指定了公钥文件和私钥文件的事实,并继续要求我输入密码。如果我每次都手动输入密码。如果我将 ssh 密钥移动到.ssh/id_rsa并.ssh/id_rsa.pub删除选项参数,那么它也可以工作。
如何为每个 repo 正确指定密钥文件,以便我可以对不同的存储库使用不同的密钥,而不是依赖一个密钥 .ssh/id_rsa
作为解决方法,我设法为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
Run Code Online (Sandbox Code Playgroud)
我的 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"
},
...
Run Code Online (Sandbox Code Playgroud)
这是相当不雅的,我希望仍然有一种方法可以指定要在文件中使用的密钥的路径satis.json。
| 归档时间: |
|
| 查看次数: |
2937 次 |
| 最近记录: |