Heroku: Git error after fork application
Setting:
I have a Node.js app (MEAN fullstack) (i.e. myApp) deployed to heroku that works great . I am using standard git push
$ git push heroku master
I wanted to create an intermediate replica of the application and use the heroku fork for that (as per https://devcenter.heroku.com/articles/fork-app ).
$ heroku fork -a myApp myApp-staging
The middleware also works great with its own database and has its own set of config variables (expected). !!! IMPORTANT
I also created a new git remote
$ git remote add staging git@heroku.com:myApp-staging.git
// repo address taken from "heroku info -a myApp-staging"
Problem:
1) If I try to push to production i.e. "git push heroic master" works great.
2) If I try to click on a stage
$ git push staging master
I am getting "Permission denied (publickey)".
3) If I try to clone my git repo staging application to a different directory, I get an empty repo
$ heroku git:clone -a industryhub-staging
// warning: You appear to have cloned an empty repository
Where is my staging repo? What Heroku code is running on my staging instance? Finally - how do I click on a stage?
source to share
Found it out. Here for posterity.
Error for incorrect remote for intermediate application. I created it with
$ git remote add staging git@heroku.com:myApp-staging.git
and I had
$ git remote -v
heroku https://git.heroku.com/myApp.git (fetch)
heroku https://git.heroku.com/myApp.git (push)
staging git@heroku.com:myApp-staging.git (fetch) // wrong
staging git@heroku.com:myApp-staging.git (push) // wrong
I had to do
$ git remote add staging https://git.heroku.com/myApp-staging.git // over https
Now my git shows
$ git remote -v
heroku https://git.heroku.com/myApp.git (fetch)
heroku https://git.heroku.com/myApp.git (push)
staging https://git.heroku.com/myApp-staging.git (fetch) // OK
staging https://git.heroku.com/myApp-staging.git (push) // OK
And life is peach again!
Note. Geroku says new repo IS EMPTY after unlocking the app . https://devcenter.heroku.com/articles/fork-app#forked-app-state
source to share