Git push heroku master causes 403 error

Asked 2 years ago, Updated 2 years ago, 98 views

Error Contents

I get an error when I try to push the rails app to heroku.

$git push heroku master
error:The requested URL returned error:403 Forbidden while accessing https://git.heroku.com/mymemo.git/info/refs

The contents of .git/config are as follows:

 [core]
        repository formatversion = 0
        filemode=true
        bare=false
        logallrefupdates=true 
[remote "heroku"]
        url=https://git.heroku.com/mymemo.git
        fetch=+refs/heads/* —refs/remotes/heroku/*

Heroku is already logged in.

I looked up several information online, but there is information about GitHub account ~~, but do I have to have a GitHub account to use heroku?

Looking at multiple sources of information, it seems that GitHub registration is not necessary, but how can I solve this problem?I can't find a useful answer after searching online.

Thank you for your cooperation.

heroku

2022-09-29 21:33

1 Answers

Run heroku create first.Heroku create creates the URL and remote of the application.

$heroku create

Remote contents can be found in .git/config.

$cat.git/config

The contents were as follows in the initial state.

 [ remote "heroku" ]
    url=https://git.heroku.com/rails appname.git
    fetch=+refs/heads/* —refs/remotes/heroku/*

Since url is the application name of rails, I will change it to the application name of heroku.It seems that you can run heroku apps to find out the name of the heroku app.

$heroku apps

Rewrite the .git/config

$vi.git/config
 [ remote "heroku" ]
    url=https://git.heroku.com/heroku_appname.git
    fetch=+refs/heads/* —refs/remotes/heroku/*

Now there are no more 403 errors.

$git push heroku master


2022-09-29 21:33

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.