How to resolve this github/heroku conflict - ruby-on-rails

I have an app on Heroku that I have had for a couple of years, but now I need to refactor some code and update some gems.
When I first started the app I was on a totally different machine. So I had to clone the github repo for that app.
Now I want to push the first changes but I get this error:
set git remote heroku to https://git.heroku.com/alfa-blog.git
I thought it was asking me to do something like this:
git remote add heroku https://git.heroku.com/alfa-blog.git
But I get this error:
fatal: remote heroku already exists.
How do I resolve this? If there is anything unclear, please let me know so I may clarify.
Do I delete the origin one?
heroku https://git.heroku.com/alfa-blog.git (fetch)
heroku https://git.heroku.com/alfa-blog.git (push)
origin https://github.com/<github-page>/Alpha_Blog.git (fetch)
origin https://github.com/<github-page>/Alpha_Blog.git (push)
Trying to rename remote repo:
$ git remote rename https://git.heroku.com/alfa-blog.git https://github.com/ldco2016/Alpha_Blog.git
fatal: No such remote: https://git.heroku.com/alfa-blog.git

You don't need to remove or rename anything, just set-url to the repo you are currently working in, like this:
git remote set-url origin https://github.com/<github-page>Alpha_Blog.git
Then you should be able to push your new changes to your existing app on Heroku.

Is the remote set to a different url right now? You could try removing it and then adding as you tried again.

Related

Heroku: Permission denied (publickey). fatal: Could not read from remote repository when doing git push

I've spent the day reviewing all the existing solutions suggested on Stackoverflow and elsewhere, and tried them without success, and I'm still stuck with this.
The "heroku keys:add" solution doesn't work for me, so please don't link me back to that one.
I'm on MacOSX Lion. Thanks
Heroku no longer needs to use the git protocol & Public/Private encryption keys, instead you can use the following command to use your Heroku API key
heroku login
This command creates (or updates) a ~/.netrc file with your Heroku API key.
Now, any Heroku remote repository can be pushed to via the https protocol, rather than the git (ssh) protocol.
Check the address of your Heroku repository for your project with:
git remote -v
If your git remote address for Heroku starts with https://git.heroku.com/... then you are good to push. If the remote address starts with git then you need to update the remote address for Heroku
git remote set-url heroku https://git.heroku.com/...
Check the Heroku dashboard Settings tab for your app for the full Git URL for that app
If you have already git initialized and heroku toolbet is completely installed , enter this command $ git remote -v it will initialize heroku git and you can push to it.
Whenever you run the command $ git remote -v , will create a git repo in app_name/.git/logs//refs/remote/heroku , first check whether your git been initialized for heroku or not, even I had the same problem and I've corrected.

Error pushing to Heroku after adding new domain

I recently added a new GoDaddy domain to my rails app.
Everything works fine when I push to git but when I try to push to Heroku using:
$ git push heroku
I get the following error:
fatal: 'heroku' does not appear to be a git repository
fatal: Could not read from remote repository
Please make sure you have the correct access rights and the repository exists.
Is this problem occurring because I need to create another environment? The domain name for my GoDaddy website is listed under '$ heroku domains' but doesn't seem to be connected.
Any ideas would be helpful. TIA!
As for your comment on answer below, its obvious that you should try
git push prod master instead of git push heroku
'heroku' and 'prod' it's just names of remote repositories. Heroku by default creates repos named accordingly - 'heroku'. As far as I know it could be changed to whatever you need
This issue is probably unrelated to godaddy. Try typing
git remote -v
this will give you a list of the remote repositories you have setup. If none are pointing to your app on heroku you'll need to set it up.
Refer to this on article from heroku dev center
https://devcenter.heroku.com/articles/git
EDIT
As i suspected your heroku remote is named "prod" not "heroku" try 'git push prod' that should work.
You might have to specify the branch in which case the command would be 'git push prod master'
EDIT2
It looks your are not yet authorized to push to heroku. The root problem can vary. I recommend starting with this article:
https://devcenter.heroku.com/articles/keys
Also check this SO article
git push heroku master Write failed: Connection reset by peer

Fatal: Heroku repository does not exist

I renamed my Heroku app from their goofy name to something more reasonable. I never imagined that it would cause me trouble here. just now I tried the following
git remote -v
heroku http://appname.herokuapp.com (fetch)
heroku http://appname.herokuapp.com (push)
origin git#github.com:MyAccount/games.git (fetch)
origin git#github.com:MyAccount/games.git (push)
I thought I had it won there. but then I tried
git push heroku master
and then i got this message
fatal: repository 'http://appname.herokuapp.com/' not found
I don't understand why it won't push
You need to change your heroku remote to match the new name for your app.
Do on the command line
git remote remove heroku
git remote add heroku git#heroku.com:YOUR_APP_NAME.git
Let me know if that doesn't fix it

Can't push on heroku

I’ve just cloned one of my repositories on github, I've made some changes and I would like to send it on the heroku application. But when I try to run git push heroku master, I get :
fatal: 'heroku' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
What can I do to solve it?
This is because there's no remote named heroku. You can see your remotes by typing git remote -v. For my 'example' app I see the following:
$ git remote -v
heroku git#heroku.com:example.git (fetch)
heroku git#heroku.com:example.git (push)
If it's missing, you can add the remote with the following command:
git remote add heroku git#heroku.com:example.git
where example is the name of your heroku app.
Before you can do
$ git push heroku master
you need to setup heroku by following the steps given at Getting Started with Heroku. Once you have setup heroku, logged in,created your app.
Verify that git remote is added
$ git remote -v
it should list a remote named heroku. if it does then the error heroku' does not appear to be a git repository will go away
If you have followed the steps in tutorial you just need to login in again:
cmd "heroke login"

Changing heroku repo for pre-existing app

I created a heroku repo some time ago for my rails app but deleted it because I was never using it. Now I have come to the point where I need to use heroku but I am encountering the following error:
! No such app as furious-mist-2295. which was the old repo name, so it is clearly not pushing to the new stack I created.
This is what I was considering trying, but am concerned about causing unnecessary changes to my git repo.
git remote rm origin
git remote add origin <URL to new heroku app>
git push -u origin master
Turns out it can be done with the following commands
git remote rm heroku
git remote add heroku git#heroku.com:new-application.git
Which is quite a simple little fix. Seemed rather difficult without knowing beforehand that these commands existed.
git remote -v came in handy to double check which repos in git and heroku were being pushed and fetched.

Resources