这个问题很简单。我部署了一个 heroku 应用程序,但找不到它的源代码。
我们如何通过 heroku CLI 或 heroku 网络界面检索给定 heroku 应用程序的 github 存储库 url?
编辑:是的,这已经困扰我一年多了
我尝试过的
我试过了heroku git:clone -a APP-NAME
它将存储库(从 heroku?)复制到本地。在 cd
进入它之后,并尝试 get the github remote url
git config --get remote.origin.url
但是返回空白。我也试过了
git remote show origin
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
最佳答案
I just tried
heroku slugs:download -a myapp
and getWarning: slugs:download is not a heroku command.
您需要安装 heroku/heroku-slugs
首先插入插件,以便识别该命令。
heroku plugins:install heroku-slugs
但是像你一样先尝试
heroku git:clone -a APP-NAME
然后 git log -1
:这将为您提供最新提交的 SHA1。
然后您可以在 GitHub 上执行 Commit search by hash .
示例:
OP stevec提及 in the comments使用“How to clone all repos at once from GitHub? ”处理超过 100 个存储库并(严格地)下载私有(private)存储库(不仅仅是公共(public)存储库)。
那就是:编写一个 bash 脚本来克隆我帐户上的每个存储库并以某种方式搜索特定的 SHA。
我建议使用简单的 git log -1 SHA
,或者,在“How to check if the commit exists in a Git repository by its SHA-1”之后:
git rev-parse -q --verify "$sha^{commit}" > /dev/null
OP 添加:
I realised your initial solution definitely works (even for private repos).
heroku git:clone -a APP-NAME git log -1, https://github.com/search?q=hash%3A<SHA>
关于github - 如何找到与 heroku 应用程序关联的 github 存储库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56688066/