If you have already created https remotes and want to switch them to use ssh, the following command can be used. Rename a remote $ git remote rename heroku staging $ git remote add staging git remote add heroku useful commands List your git remotes $ git remote -v
$ heroku git:remote -a staging-app -r stagingĪs points out, all of the examples above use the https protocol for connecting to the remotes, but it is also possible to connect via ssh. $ heroku git:remote -a staging-appĮdit: Thanks to for pointing out you can supply a remote name to this command with the -r flag. If you would like to use a different name for your remote, see the "Rename a remote" section below. However, it looks like this will always use the default remote name heroku for the remote. $ git remote add heroku Īs points out, you can alternatively use a Heroku CLI command to add your remote. In this video, learn the two different ways of fetching and merging code from the remote. $ git push staging staging:master -fĪdd a remote for your Production app and deployuīy convention, the remote name "heroku" is typically used for the production application. As yet another alternative way to get the repository history, you could initialize the downloaded zip as a new Git repository, add the remote repository, fetch, and reset to it: unzip project.zip cd project git init git remote add origin urlongithub git fetch origin git reset origin/master git status. After creating a remote Git repository, its time to add it to your remotes and push your code to it. If you are very sure you want to proceed, add the -force ( -f) flag. In some cases, your local branch may be missing some commits that were already deployed to Heroku, resulting in an error. The format option also accepts popular compressed file formats zip and tar.gz.
If you want to deploy a different branch, you can use the syntax local_branch:destination_branch seen below (in this example, we push the local staging branch to the master branch on heroku. Sometimes it can be useful to create an archive file of a Git repository.
Note that on Heroku, you must always use master as the destination branch on the remote. Adding a new remote Add a remote for your Staging app and deploy In the Description field of the Edit Repository dialog box, enter or edit the repository description, and click Update. Alternatively, on the Project Settings: Repositories page, mouse over the Git repository name, click Options, and select Edit.
However, if you are working on an existing app and want to add git remotes to enable manual deploys, the following commands may be useful. In the Files or Logs view, click the repository description to edit it. Generally, you will add a git remote for your Heroku app during the Heroku app creation process, i.e.