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.
Related
I deploy heroku server and link to Github.
when I change my code, I git add . -> git commit ->
after then, I did:
git push origin master && git push heroku master
origin master is for Github, heroku master is for Heroku.
I guess it was fine to just git push origin master since it was already linked to heroku.
But I just did both for doing it surely.
However, error mail comes from Heroku:
an automatic deployment failed.
the build failed with the message your account has reached its concurrent builds limit
So what should I do ?
It is okay leave it as it is now?
when I click Compare diff from Heroku.
the last commit appears.
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 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
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.