So I used heroku create with one of my apps, but then when on heroku.com I deleted the corresponding repository. I tried using heroku create again and it did give me another URL, but now when I try to push my app it keeps looking for the old one:
! No such app as [old name]
fatal: The remote end hung up unexpectedly
How do I get heroku to stop looking for this old app and use the newly created one?
Your local git repository has the old URL saved in its heroku remote. You have to update it using
git remote set-url --push heroku git#heroku.com:new_app.git
See Heroku's documentation and the Git manpage for more information.
Related
I have been using heroku already for my rails app. I have come back to do some more work on the app but when I do
git push heroku master
I get
fatal: 'heroku' does not appear to be a git repository
fatal: Could not read from remote repository.
but
git remote -v
gives
origin git#github.com:x/guidelines.git (fetch)
origin git#github.com:x/guidelines.git (push)
So I assume that means that the repo is there somewhere? Any ideas where I'm going wrong?
Yes, don't worry all is fine.
You need to go to heroku.com and get the git URL of your application from the Apps > App Name > Settings page. You're looking for git#heroku.com:<application-name>.git.
Back at your command line readd the heroku remote via;
git remote add heroku git#heroku.com:<application-name>.git
and you'll be then able to push to the heroku remote.
My laptop died and I need to code from another computer.
I am working with Heroku and I want to get the latest version of code from Heroku to another machine.
I understood that it is very recommended to get a proper remote repository using GitHub or BitBucket.
I decided to try BitBucket.
While creating my account, it asks for the old URL of my git repo. Since my machine is dead, I was hoping to fill in the heroku URL but that didn't work.
Any ideas how to proceed?
The idea is that I could pull and push my changes from either machines (when my laptop comes from repair).
You can simply clone your Heroku repository to your local machine. Then add BitBucket as a remote and push the code there.
Find out the Heroku repo url on the settings page of your app
https://dashboard.heroku.com/apps/[APP]/settings
git clone git#heroku.com:[APP].git
git remote add bitbucket ssh://git#bitbucket.org/[ACCOUNT]/[REPO].git
git push bitbucket master
As I am new at this, I am not sure if this is how it should be -
I am making a webapp and using heroku for hosting
I want to have several developers working on the same code on github.
I'd like to have 2 servers on heroku - one for production and one for testing(is it also called staging?)
problem is I know what by doing git push heroku master from the webapp folder it will send it to the application to the heroku server which was setup in the first place.
How do I deploy to 2 different heroku instances from the same folder using git? Is it possible/ recommended?
When I push to github it's usually the master, should I have another branch for test?
Is there a way to transfer an app between heroku instances?
if there's a place where there is a recommended deployment routine for heroku and github I'd be happy to read it
When you run git push heroku master 'heroku' identifies the remote repository you are pushing to. In your case 'heroku' seems to be a reference to your production server. Similarly you probably have an 'origin' remote pointing to github.
If you list your git remotes you'll probably see something like this:
> git remote -v
heroku git#heroku.com:heroku_app_name.git (fetch)
heroku git#heroku.com:heroku_app_name.git (push)
origin git#github.com:your_github_org/repo_name.git (fetch)
origin git#github.com:your_github_org/repo_name.git (push)
To push to a different heroku app you can just add that app as a new git remote.
git remote add heroku-staging git#heroku.com:heroku_staging_app.git
Now you should be able to push to either remote as needed.
git push origin master //push to github
git push heroku-staging //deploy to staging
git push heroku master //deploy to production
In general I suggest that you should not be pushing to heroku manually. Hopefully you can have a continuous integration server watch github, run tests whenever you push changes, and deploy to staging only when your automated tests pass. You can then have a manually triggered CI task which pushes whichever commit is currently on staging to production as well (or even automate production deploys as well).
You can perform the same configuration using the heroku command line. That also gives you a good way to manage environment variables and other settings on both of your heroku apps:
https://devcenter.heroku.com/articles/multiple-environments
I've been using Heroku normally in the past few months. In the beginning, I created a ssh key, I added it to my Heroku account and I could deploy my apps without any problem. Until today. I'm working on a new project and I needed to create a new Heroku account under a different e-mail address. After a while I realized I couldn't deploy this app using a new e-mail address because my SSH key was associated to a different e-mail. Then I created a new SSH key and added it to my new Heroku account. It didn't work! :)
Well, I removed the key from my computer and from my new Heroku account. Then I decided to go back to my original Heroku account. Everything works, well, more or less. I can still deploy my old apps, I can see I only have one SSH key there, I can run the commands: heroku info, heroku apps, etc.
So then I tried to deploy my new app, but before I created a new Heroku app using: heroku create. The new app was created successfully. But when I try: git push heroku I get this error:
! Your key with fingerprint
b2:69:3b:90:1e:e1:60:ad:a0:b9:f7:::*:* is not authorized to
access furious-leaf-9996.
If I try: heroku info, I get this error:
! You do not have access to
furious-leaf-9996.
The funny thing is, if I switch to the other app's directory and try to do the same thing (ex.: heroku info, git push heroku), everything works perfectly.
Note 1: When I try heroku logout then heroku login, I'm always able to connect, in both app's directory
Note 2: I'm using RVM and both apps use different gemsets.
I don't know what else to do!! Anyone??
Thanks!
After getting almost crazy I found out what was happening.
When I first tried to login on my second Heroku account, my .git config file was updated with this info:
[remote "heroku"]
url = git#heroku.com:furious-leaf-9996.git
fetch = +refs/heads/*:refs/remotes/heroku/*
And this was the problem. Even logging out and logging in again in different Heroku accounts, every time I tried to push my files there, I couldn't because I didn't have access to this repository. And it got worse because I deleted this repository. :)
Now everything is working properly.
So next time you have access problems on Heroku, take a look at your git config file!
Thanks!
I am using heroku to host my application. With merges and rebases i got 2 different stages of my app.
Local master is different from master on heroku.
pushing to heroku master failed with:
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git#heroku.com:xxxxx.git'
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
is there a way to delete the heroku master?
then i can push it again to heroku master..
You can force push
git push --force origin master
That will overwrite remote master.
You can also delete remote branch by doing this
git push origin :master
Note the colon before branch name. This command says "take void from local machine and put this instead of remote branch 'master'"
In my case, I renamed the branch on Heroku from master to main, and I want to delete the old master branch. If I delete the remote master branch directly on Heroku, it will be rejected.
The only way I found working is based on this document to reset.
Assume your app name is my-app. You can reset by
heroku plugins:install heroku-repo
heroku repo:reset --app=my-app
Note this will remove all branches in Heroku. So you need push to Heroku again by
git push heroku main