如何从Heroku中检索使用“Deploy to Heroku”按钮部署的代码

问题描述 投票:0回答:2

通常,您可以使用heroku git:clone命令检索Heroku应用程序的代码。如果使用Heroku'Deploy to Heroku'按钮部署应用程序,则克隆会导致空回购(有关详细信息,请参阅here)。

检索上面链接中描述的代码的方法假定原始repo仍然存在。

如果原始仓库不再存在,我将如何检索代码?

git heroku
2个回答
1
投票

为了做到这一点,我使用了以下命令:

mkdir -p {app name} && heroku run "tar -cz * | base64 -w 0" --app {app name} | base64 -D | tar -xzf - -C {app name}

这是来自MacOS中的bash,因此一些本地bash命令参数在其他版本的Unix中可能会有所不同。

根据您的应用程序,您可能需要在tar -cz命令中排除某些目录(例如--exclude='./node_modules'


0
投票

您可以heroku run bash并手动复制代码。

© www.soinside.com 2019 - 2024. All rights reserved.