Issues with "git push heroku master"
I began taking up Heroku again, but have had some problems trying to get it to where I could upload an app to my server. I have taken the steps already to have the Heroku gem properly installed and both Sinatra and Ruby installed onto my Mac. Since I have been away from it for a while, I did these steps:
gem remote rm heroku
gem remote add heroku git@her开发者_JAVA百科oku.com:pxlc.git
cd Desktop/myapp
git init
git add .
git commit -m 'Initial commit'
git push heroku master
After that I get this strange error telling me to do a "git pull". Shouldn't I have been able to put in my .ssh key and Heroku credentials?
An error telling you to do a pull is telling you that you can't push in your current state because you'd overwrite some other work that's been pushed to the git remote. You first have to pull to merge the remote changes into your local code, then push. It looks like you're creating brand new repo and trying to push it somewhere where something already exists.
Edit: To do what it's telling you, just git pull heroku master
. It will fetch all the remote changes and merge them into your branch for you. This could fail with merge conflicts, which you'd then have to resolve. If it's successful, there's nothing else to do.
If you really do want to wipe out anything that's there--as in lost forever wipe out--you can git push -f heroku master
to force the push.
the heroku steps confuse me too for a pristine new project
init,commit, THEN git remote add heroku=>the git address given by heroku command THEN push
i get stuck often so i like to add it directly to .git/config file myself)
if heroku is at -1 (no history) there should be no issue pushing your git repo (along with yr history) to heroku side
精彩评论