【Azure 应用服务】App Service For Linux 环境中,如何从App Service中获取GitHub私有库(Private Repos)的Deploy Key(RSA ke...

问题描述

为App Service For Linux配置CI/CD,源代码在GitHub私有库中,在发布时候报错 Cannot find SourceControlToken with name Bitbucket. 这样的情况如何来解决呢?在参考了文章

得知需要在GitHub/Bitbucket/GitLab中配置Deploy Key。 那么我们如何来获取这个Key呢?

问题解答

第一步: 在App Service门户的Deployment Center页面获取用户名和密码

image.png

第二步: 组合获取 SSH Key 的请求URL

 https://<$用户名>:<密码>@<站点名>.scm.chinacloudsites.cn/api/sshkey?ensurePublicKey=1 
  • <用户名>:使用第一步中的UserName代替,注意,只需要 后面的部分,需要包含符号
  • <密码> :第一步截图中的Password内容
  • <站点名> :当前Web App的名称

第三步: 通过Postman或者curl 获取到 ssh-rsa Key

curl https://$xxxxx:qr3kuR7ygxxxxxxxxxcDt@xxxxxxx.scm.chinacloudsites.cn/api/sshkey?ensurePublicKey=1
image.png

附录一: 如何在App Service for Linux中查看 .ssh 文件夹

登录到SSH页面:https://yourappservicename.scm.chinacloudsites.cn/webssh/host

# find / -name .ssh

# cd /home/xxxxxxxxxxxxxxxxxxx??????????????????/.ssh

# ls -l

查找截图:


image.png

参考文档

1:https://erikschlegel.com/2015/06/20/azure-continuous-deployment-using-git-private-repos/

2:https://github.com/projectkudu/kudu/wiki/Continuous-deployment#setting-up-continuous-deployment-using-manual-steps

当在复杂的环境中面临问题,格物之道需:浊而静之徐清,安以动之徐生。 云中,恰是如此!

分类: 【Azure 应用服务】

标签: App Service, App Service for Linux, 获取GitHub私有库(Private Repos)的Deploy Key

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容