I'm wondering if it's possible to copy my Heroku deployment, along with its commit history to a new repository in github. I want to upload the code to my account and include all its history rather than having just one commit. Is this possible?
Asked
Active
Viewed 69 times
0
-
1Have you lost the original Github repository? – ceejayoz Feb 18 '20 at 20:28
-
No, but I had been pushing my commits to Heroku only. Wanted to get it on my github too with all the commits so people can view it. – a_byte_of_pizza Feb 19 '20 at 01:57
-
1In that case, fire up a Github repository for it, and follow their instructions for connecting it to an *existing* local Git repo (the one you already have locally). – ceejayoz Feb 19 '20 at 01:58
1 Answers
1
I'm wondering if it's possible to copy my Heroku deployment, along with its commit history to a new repository in github. I want to [preserve] all its history ..
Yes.
Use something like git remote -v
to find the URL of your repository at heroku. It might look like this:
origin git@github.com:myorg/myproject.git (push)
prd https://git.heroku.com/myapp.git (fetch)
If you can't use git remote
you can guess the URL using the name of your app.
Then git clone https://git.heroku.com/myapp.git
.
Now you can push your local copy to git with the usual github routine.

Jared Beck
- 16,796
- 9
- 72
- 97
-
2...but [don't make a habit of it](https://devcenter.heroku.com/articles/git-clone-heroku-app): "A Heroku app’s Git repository is intended for deployment purposes only. Cloning from this repository is not officially supported as a feature and should be attempted only as a last resort. **Do not** use this repository as your app’s canonical “origin” repository. Instead, use your own Git server or a version control service such as GitHub." I know OP is asking how to clone specifically so they can put it on GitHub, but this might be a useful note for future visitors. – ChrisGPT was on strike Feb 19 '20 at 00:11
-