[git] How to link a folder with an existing Heroku app

I have an existing Rails app on GitHub and deployed on Heroku. I'm trying to set up a new development machine and have cloned the project from my GitHub repository. However, I'm confused as to how to link this folder up to Heroku. Originally, I used the heroku create command, but obviously I don't want to do that this time since it will create another Heroku instance.

This question is related to git heroku

The answer is


You should probable start ssh-agent and add your keys. Check this,

http://wordgraphs.com/post/5000/Heroku--Permission-denied--publickey---fatal--Could-not-read-from-remote-repository-

It helped me.


I've my project in github and heroku, for upload an heroku use :

heroku git:remote -a <project>

The doc it is:

https://devcenter.heroku.com/articles/git


Don't forget, if you are also on a machine where you haven't set up heroku before

heroku keys:add

Or you won't be able to push or pull to the repo.


The Heroku CLI has an easy shortcut for this. For an app named 'falling-wind-1624':

$ heroku git:remote -a falling-wind-1624
Git remote heroku added.

See https://devcenter.heroku.com/articles/git#creating-a-heroku-remote


for existing repository

type in terminal

$ heroku git:remote -a example

enter image description here


Use heroku's fork

  1. Use the new "heroku fork" command! It will copy all the environment and you have to update the github repo after!

    heroku fork -a sourceapp targetapp
    
  2. Clone it local

    git clone [email protected]:youamazingapp.git
    
  3. Make a new repo on github and add it

    git remote add origin https://github.com/yourname/your_repo.git
    
  4. Push on github

    git push origin master
    

Two things to take care while setting up a new deployment System for old App

1. To check your app access to Heroku (especially the app)

heroku apps

it will list the apps you have access to if you set up for the first time, you probably need to

heroku keys:add

2. Then set up your git remote

For already created Heroku app, you can easily add a remote to your local repository with the heroku git: remote command. All you need is your Heroku app’s name:

heroku git:remote -a appName

you can also rename your remotes with the git remote rename command:

git remote rename heroku heroku-dev(you desired app name)

then You can use the git remote command to confirm that a remote been set for your app

 git remote -v

heroku login 

git init

heroku git:remote -a app-name123

then check the remote repo :

git remote -v

Examples related to git

Does the target directory for a git clone have to match the repo name? Git fatal: protocol 'https' is not supported Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) git clone: Authentication failed for <URL> destination path already exists and is not an empty directory SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443 GitLab remote: HTTP Basic: Access denied and fatal Authentication How can I switch to another branch in git? VS 2017 Git Local Commit DB.lock error on every commit How to remove an unpushed outgoing commit in Visual Studio?

Examples related to heroku

How to fix error "ERROR: Command errored out with exit status 1: python." when trying to install django-heroku using pip Can't push to the heroku ImproperlyConfigured: You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings How to enable CORS in flask Error: Cannot pull with rebase: You have unstaged changes How to solve error "Missing `secret_key_base` for 'production' environment" (Rails 4.1) Failed to execute 'postMessage' on 'DOMWindow': The target origin provided does not match the recipient window's origin ('null') 'heroku' does not appear to be a git repository Heroku 'Permission denied (publickey) fatal: Could not read from remote repository' woes How do I set up DNS for an apex domain (no www) pointing to a Heroku app?