【发布时间】:2019-11-03 09:32:24
【问题描述】:
这个问题很简单。我部署了一个 heroku 应用,但我找不到它的源代码。
我们如何通过 heroku CLI 或 heroku Web 界面检索给定 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.
【问题讨论】:
-
您确定存在一个与该应用关联的 GitHub 存储库吗?可能没有。最初是谁部署的?
-
@Chris 我部署了它,它肯定是从 github repo 部署的(我不知道其他方式)。我只是不知道这个应用程序来自哪个 github repo,并且不想删除它以防万一那里有重要的东西。我认为 heroku 应该在某处声明 github url,这将是一个简单的解决方案,但我似乎无法找到它
-
所以...您从 GitHub 部署它,但您不记得从哪个特定存储库部署?您可以使用
heroku releases查看提交哈希。我不确定是否有任何显示 GitHub 存储库的内容,但请尝试在那里查看。 -
@Chris 是的。如果您有数百个应用程序,这不难想象。 Heroku 的优势在于它使部署应用程序变得微不足道(例如,从笔记本电脑到 git 到 heroku 大约需要 30 秒)。这对于快速部署微服务等非常有用。每隔一段时间,我就会清理未使用或必要的应用程序,这直到现在都不是问题,因为大多数应用程序的根 url 都有一些东西。但在一种情况下,它没有,我不想删除它,直到我确定它不重要。
-
@Chris Running
heroku releases -a myappname返回预期输出(但没有提及 repo)。我尝试git log -n 1 9643b02d -a myappname(其中提交是第一个命令输出中最新的),并得到fatal: not a git repository (or any of the parent directories): .git