前段时间我在一个 Github 存储库中发现了一些代码。我下载了它(没有 fork 它),开始升级它,当我对结果感到满意时,我使用 Heroku 作为主机。所以现在代码存在于我的电脑和 Heroku 上。我怎样才能将它推送到我的 Github 帐户,同时也给该项目的原始作者一些荣誉(在我的 Github 上显示我实际上 fork 了它)?
最佳答案
好吧,所以我实际上已经弄清楚了!
首先,在 github 上创建一个新的存储库,我们将其命名为 github-project。
git clone <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="76111f02361e1304191d035815191b" rel="noreferrer noopener nofollow">[email protected]</a>:<heroku-project>.git
cd <heroku-project>
git remote rm origin
git remote add github https://github.com/<github-username>/<github-project>
git pull github master
现在您可能会看到一些冲突。如果您想保留所有更改,只需将它们全部添加即可。
git add .
git commit -m "some message"
git push github master
关于heroku - 将 fork 项目从 Heroku 迁移到 Github,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17240429/