'heroku' does not appear to be a git repository

前端 未结 21 1946
失恋的感觉
失恋的感觉 2020-12-12 08:47

When I try to push my app to Heroku I get this response:

fatal: \'heroku\' does not appear to be a git repository
fatal: Could not read from remote repositor         


        
相关标签:
21条回答
  • 2020-12-12 08:54

    Following official Heroku article:

    Initialize GIT

    $ cd myapp
    $ git init
    
    $ git add .
    $ git commit -m "my first commit"
    

    Then create (initialize) heroku app with:

    $ heroku create YourAppName
    

    Lastly add git remote:

    $ heroku git:remote -a YourAppName
    

    Now you can safely deploy your app with:

    $ git push heroku master
    

    You should wait for some time and see if you don't get any error/interrupt on console while deploying. For details look at heroku article.

    0 讨论(0)
  • 2020-12-12 08:56

    Might be worth checking the config file in the .git folder. If the heroku parameters are missing then you´ll get this error heroku param

    [remote "heroku"]
        url = git@heroku.com:`[Your heroku app].git
        fetch = +refs/heads/*:refs/remotes/heroku/*
    

    the .git folder should be in the local computer file directory for the app you created in heroku. e.g C:\Users\You\Your app.git

    Hope this helps

    0 讨论(0)
  • 2020-12-12 08:56

    If this error pops up, its because there is no remote named Heroku. When you do a Heroku create, if the git remote doesn’t already exist, we automatically create one (assuming you are in a git repo). To view your remotes type in:

    git remote -v”. # For an app called ‘appname’ you will see the following:

    $ git remote -v
    heroku git@heroku.com:appname.git (fetch)
    heroku git@heroku.com:appname.git (push)
    

    If you see a remote for your app, you can just “git push master” and replace with the actual remote name.

    If it’s missing, you can add the remote with the following command:

    git remote add heroku git@heroku.com:appname.git
    

    If you’ve already added a remote called Heroku, you may get an error like this:

    fatal: remote heroku already exists.
    

    so, then remove the existing remote and add it again with the above command:

    git remote rm heroku
    

    Hope this helps…

    0 讨论(0)
  • 2020-12-12 09:00

    I've seen all the answers here and the only thing missing is after going through these steps:

    $ git add .
    $ git commit -m "first heroku commit"
    

    You should run the command below:

    $ heroku git:remote -a <YourAppNameOnHeroku>
    

    And lastly, run this:

    $ git push -f heroku <NameOfBranch>:master
    

    Notice I used <NameOfBranch> because if you're currently in a different branch to master it would still throw errors, so If you are working in master use master, else put the name of the branch there.

    0 讨论(0)
  • 2020-12-12 09:02

    I had to run the Windows Command Prompt with Administrator privileges

    0 讨论(0)
  • 2020-12-12 09:03

    For me the answer was to cd into the root directory of the app before running heroku create or git push heroku master

    0 讨论(0)
提交回复
热议问题