我正在尝试使用bitbucket为Azure网站设置连续部署。
问题是我正在使用Azure没有权限的子模块(我拥有),因为默认情况下不会添加该子模块。
我试图弄清楚如何添加SSH密钥,以便Azure可以连接并获取子模块。
我已采取的步骤。
使用PuttyGen创建了一个新的公钥/私钥,将公钥添加到了我的Bitbucket帐户下,名称为Azure
通过FTP传输到Azure,并将公共密钥文件和私有密钥文件(.ppk)添加到.ssh目录(是的,我不知道该添加哪个文件)。它们分别命名为azurePrivateKey.ppk和azurePublicKey。
更新了我的配置文件,看起来像这样
HOST *
StrictHostKeyChecking no
Host bitbucket.org
HostName bitbucket.org
PreferredAuthentications publickey
IdentityFile ~/.ssh/azurePrivateKey.ppk
(不知道是不是)
更新了我的已知主机,看起来像这样
bitbucket.org,131.103.20.168, <!--some key here...it was here when i opened the file, assuming it's the public key for the repo i tried to add-->
bitbucket.org,131.103.20.168, <!--the new public key i tried to add-->
而且我仍然遇到相同的错误,没有获得子模块的权限。所以我很难弄清楚我做错了哪一步,因为我以前从未做过。
我从未在Azure中进行过设置,但是有一些处理SSH密钥的一般经验法则:
$HOME/.ssh/
中的私钥必须具有文件模式600(仅所有者拥有RW)id_rsa
和id_rsa.pub
,但您可以将文件名更改为所需的任何名称known_hosts
存储您已连接的服务器的公共密钥。这对于确保您确实再次连接到同一服务器很有用。 more detailed information on this topicHTH
最好不要迟到,永远不会对其他人有用:
Web应用程序已经具有ssh密钥以获取它:https://[web-site-name].scm.azurewebsites.net/api/sshkey?ensurePublicKey=1
然后您可以将此密钥添加到git repo部署密钥中。
因此,在部署应用程序服务时,如果您像我一样在同一个github帐户上拥有多个私有子模块,则可以通过移动部署键来使您的服务访问所有模块。
此后,服务可以使用密钥访问所有帐户上的私人存储库。