github - 如何找到与 heroku 应用程序关联的 github 存储库?

标签 github heroku

这个问题很简单。我部署了一个 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 get

Warning: 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 .
示例:

https://github.com/github/gitignore/search?q=hash%3A124a9a0ee1d8f1e15e833aff432fbb3b02632105&type=Commits


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/

相关文章:

postgresql - Heroku - 无法通过 Play Framework 应用程序设置 postgres 数据库?

git - 为什么 Git 即使在配置之后也不允许我提交?

javascript - 将 Sails JS 部署到 Heroku 时找不到图像

java - 从 Eclipse 中的模板创建 Heroku 应用程序?

eclipse - 如何让eclipse记住ssh key 密码?

postgresql - 为什么 psycopg2 和 pyodbc 以不同方式连接到数据库?我如何翻译连接?

python - Heroku 上的 Flask 数据库迁移

git - Jenkins基于Git Branch执行Bash

git - 您的带指纹 (..) 的 key 未经授权(协作)

github - 运行 Github Action 当 PR 从特定分支名称提升到特定分支名称时?