Heroku - git push - heroku

Can anyone please explain what's wrong with these?
mhsjaber:~/workspace/newsite (master) $ heroku keys:add
? Which SSH key would you like to upload? /home/ubuntu/.ssh/id_rsa.pub
Uploading /home/ubuntu/.ssh/id_rsa.pub SSH key... done
mhsjaber:~/workspace/newsite (master) $ heroku create
Creating app... done, ⬢ ancient-island-20017
https://ancient-island-20017.herokuapp.com/ | https://git.heroku.com/ancient-island-20017.git
mhsjaber:~/workspace/newsite (master) $ git push heroku
No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
Everything up-to-date

You have to add something first to push to heroku server. As your repository is already created on heroku thus, you have to add your app on it, in order to do that follow below steps.
(1) heroku login
(2) git init
(3) git add .
(4) git commit -am "comment"
(5) git push heroku master
in your case you were confusing heroku by not adding master in your git push command.

Related

How to update a website deployed on heroku?

I created a website that I deployed on heroku. I have made some changes there and am looking to update my website to reflect these changes. To do this, I ran the following commands:
git status
git init
git status
git remote -v
git add .
git commit -m"The file"
git push heroku masterbranch
I want to clarify that the masterbranch branch is a branch that has been created. The base branch of my website is master not masterbranch. The reason why, I created a new branch is that when I ran the command: git push heroku master I was getting the error:error: failed to push some refs to 'https://git.heroku.com/gkwhelps.git' But I don't think that is the reason why my deployed site does not is not up to date.
This has nothing to do with Git itself. See the heroku documentation, which notes that:
Heroku only deploys code that you push to the master or main branches of the remote. Pushing code to another branch of the heroku remote has no effect.
You mention:
when I ran the command: git push heroku master I was getting the error: error: failed to push some refs to 'https://git.heroku.com/gkwhelps.git'
When you push to the main or master branch, Heroku will:
read your code;
attempt to build your code based on what it read in step 1;
attempt to deploy your build from step 3.
Any of these three steps can have errors. If they do have errors, Heroku uses Git to relay these errors to you and then tells Git to produce the above error message. So Git says that your push failed, but that's because Heroku told Git to fail it. You cannot fix this problem by creating another branch. You must address the problems that occurred in steps 1, 2, and/or 3.
If you first push your code on Github and from Github do deploy, you shoud do:
git status
git add .
git commit -m 'changes'
git push
After that you should connect Heroku with Github and do deploy from that branch from Github.

How to redeploy my laravel application to heroku when I deleted the url that heroku gave me

I have deleted that in dashboard due to some errors during deployment with
$ git push heroku master
and now I want to deploy my laravel application once again. But everytime during deployment it keeps on pushing to that old url. And not to the one that heroku gave me during when I type
$ heroku create
What seems to be my problem ?
Remove old remote
git remote rm heroku
and add again with
heroku git:remote -a your-app-name
or
git remote set-url heroku <new-url>

How to check if my repository has been deployed to heroku?

I have several repositories and only one has been deployed to heroku. How do I find out which one? Because I made a change in one repo and tried to push it but got a warning fatal: 'heroku' does not appear to be a git repository. Is there a command?
It looks like you have not created heroku repository yet or you are in wrong directory. Go to the directory where you have your app then create heroku with the help of below commands.
git init
heroku create
after creating heroku you can add and commit heroku with the help of
git add .
git commit -am "any comment"
last step will be to push all your data to heroku server by
git heroku push master
If repository is already created, you can check associated repository by hitting below command
$ git remote -v
You may need to run heroku git:remote command to associate a Git repository with an existing application
for more information on how to deploy app click here

Codeship: How to overide Codeship's automatic git push to Heroku?

At the end of my build, Codeship does an automatic push to Heroku. I would like to override this push with my own git push. How can I stop these lines from happening:
git remote add my-app git#heroku.com:my-app.git
git push heroku_my-app $CI_COMMIT_ID:refs/heads/master
What I would like to do is replace Codeship's auto git push with my own git push:
git add my-artifact.js
git commit -am "commited"
git remote add heroku git#heroku.com:my-app.git
git push -f heroku master
Codeship says there's an option to "configure the Heroku deployment to force push"
You can do the following
Delete the Heroku Deploy Step
Create a new Custom Script Deployment Step
Add the commands above
The go to the Environment Variables section and set HEROKU_API_KEY to your API key that you had used in the original Heroku Deploy Step

git with app in heroku and github

With an app in heroku, with git url like git#heroku.com:app.git,
And a repo in github https://github.com/username/other_app.git
Is possible sync the two repos for hosting the sema app in two git servers (heroku and github) ?
And also Link Heroku app to Github repo. For what?
Yes of course this is possible, because git is a distributed repository. You can configure multiple remotes, one at GitHub and one at heroku, and just push your changes to both of them.
Example:
Create repository at GitHub
Clone this repository on your machine, now you have setup the remote "origin" to be GitHub
Setup heroku and add the heroku git remote (either by running heroku create or heroku git:remote -a my_heroku_app). Find details in the git documentation of heroku.
here are some useful commands when working with github/heroku:
show github remote:
git remote show origin
show heroku git:
git remote show heroku
push github to heroku:
git push heroku master
if you have a 'staging' branch on github and want to push this to heroku git (master) for a
'staging app':
git push heroku staging:master -v

Resources