9

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://git@heroku.com.insteadof=https://git.heroku.com/
remote.heroku.url=https://git.heroku.com/test774.git
remote.heroku.fetch=+refs/heads/*:refs/remotes/heroku/*
Community
  • 1
  • 1
Kunok
  • 8,089
  • 8
  • 48
  • 89
  • Try "git push heroku master" – Akram Fares Feb 13 '16 at 09:28
  • @AkramFares same error. – Kunok Feb 13 '16 at 09:29
  • What this command "git fetch --all --tags" return ? – Akram Fares Feb 13 '16 at 09:31
  • @AkramFares OUTPUT: `Fetching heroku` NEXT LINE `fatal: No path specified. See 'man git-pull' for valid url syntax` NEXT LINE `error: Could not fetch heroku` NEXT LINE `Fetching origin` – Kunok Feb 13 '16 at 09:32
  • "fatal: No path specified. See 'man git-pull' for valid url syntax" This tells you the git-pull is failing. To narrow down the problem, try doing a git pull master from your command line, to see if it fails locally. Be careful: "Because pull performs a merge on the retrieved changes, you should ensure that your local work is committed before running the pull command." – Elvn Feb 15 '16 at 14:02
  • `git pull` -> Already up-to-date. `git pull origin` -> Already up-to-date. `git pull master` -> Please make sure you have the correct access rights and the repository exists. – Kunok Feb 15 '16 at 14:14
  • it seems the origin dosen't exist. Run this 'git remote show heroku' to show u the current origin of your app – Phil Feb 15 '16 at 15:18
  • @philipoghenerobobalogun Check screenshot for the output: http://i.imgur.com/JYlX8mm.png – Kunok Feb 15 '16 at 15:28
  • Did you try heroku's ssh remote? – Ali Dehghani Feb 15 '16 at 16:56
  • change your current remote uri to `git@heroku.com:test774.git` – Ali Dehghani Feb 15 '16 at 16:59
  • You can use this command `git remote set-url heroku git@heroku.com:test774.git` – Ali Dehghani Feb 15 '16 at 17:01
  • based on the answer you referenced in your question the solution was for origin try the same thing for heroku. use `git remote rm heroku` and `git remote add heroku 'https://git.heroku.com/test774.git'` notice the url path is in quotes. Try pulling and pushing again – Phil Feb 16 '16 at 00:43

3 Answers3

1

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://git@heroku.comkunokdev.git (fetch)
heroku  ssh://git@heroku.comkunokdev.git (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://git@heroku.com/kunokdev.git

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

Kunok
  • 8,089
  • 8
  • 48
  • 89
0

Rather obvious, but you could have skipped this line.

heroku git:remote -a appname

Then do what you did here.

git remote add heroku ssh://git@heroku.com/kunokdev.git

git remote add name_of_remote is a standard git command so no need to use heroku CLI for that part.

The convention for git push is

git push name_of_remote_repo name_of_local_branch

If you're going to learn rails development you might as well do some basic reading or course on GIT. You can learn the fundamentals in a matter of hrs. https://www.codeschool.com/courses/try-git

lacostenycoder
  • 10,623
  • 4
  • 31
  • 48
-1

Did you do the step to create the app at heroku? $ heroku create #some-name-you-choose

Did you go to your heroku account and check to see if the path was created?

jrfent
  • 13
  • 3