Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git push heroku origin ~ fatal: No path specified

Tags:

git

heroku

I am following this tutorial https://www.railstutorial.org/book/static_pages#sec-sample_app_setup and I successfully completed all steps (git commit and push on github, heroku login and heroku app creation) until this command:

$ git push heroku master

I also tried:

$ git push heroku origin
$ git push heroku

And it resulted in this error:

> fatal: No path specified. See 'man git-pull' for valid url syntax

I tried to solve it by following this answer but it didn't work for me.

After I tried what the top answer suggested, this is my config file in .git:

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
[remote "origin"]
    url = https://github.com/kunokdev/sample_app.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master
[remote "heroku"]
    url = https://git.heroku.com/test774.git
    fetch = +refs/heads/*:refs/remotes/heroku/*

Any ideas what the problem is? I am using Ubuntu 14.04 OS.

$ git config --list | grep heroku

url.ssh://[email protected]=https://git.heroku.com/
remote.heroku.url=https://git.heroku.com/test774.git
remote.heroku.fetch=+refs/heads/*:refs/remotes/heroku/*
like image 407
Kunok Avatar asked Feb 13 '16 09:02

Kunok


People also ask

How do you fix fatal origin does not appear to be a git repository?

Note: The “fatal: 'origin' does not appear to be a git repository” error occurs when you try to push code to a remote Git repository without telling Git the exact location of the remote repository. To solve this error, use the git remote add command to add a remote to your project.

How do I deploy heroku with an existing git repository?

To deploy your app to Heroku, use the git push command to push the code from your local repository's main branch to your heroku remote. For example: $ git push heroku main Initializing repository, done.

What is heroku git url?

In your heroku account, go to your app -> Settings. Under App Information, you'll find the heroku git url.


1 Answers

I managed to solve this problem so I am sharing solution here. So these are the steps from 0 to deploy:

$ cd path/to/dir
$ git init
$ git add -A
$ git commit -m "Initialized"
$ heroku login
$ heroku create appname
$ heroku git:remote -a appname
$ git remote -v

At this point, we can see the problem. For some strange reason heroku generated invalid URL. As you can see in the output: (Note: I used kunokdev as app name)

heroku  ssh://[email protected] (fetch)
heroku  ssh://[email protected] (push)
origin  https://github.com/kunokdev/kunokdev.git (fetch)
origin  https://github.com/kunokdev/kunokdev.git (push)

Do you see the first two lines? It has ...heroku.comkunokdev.git instead of heroku.com/kunokdev.git As one good man in Ruby On Rails group suggested; To fix this, I needed to remove remote and add modified one like this:

$ git remote rm heroku
$ git remote add heroku ssh://[email protected]/kunokdev.git

At this point when you use $ git push heroku master there should be no error related to invalid path url.

like image 160
Kunok Avatar answered Oct 27 '22 23:10

Kunok