Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git push origin master returns "fatal: No path specified."

Tags:

I recently set up a new account with github. I'm following a Rails tutorial from Michael Hartl online ( http://www.railstutorial.org/book#fig:github_first_page ) and followed his instructions to set up my git which were also inline with the setup instructions at github. Anyways, the "Next Steps" section on github were:

  mkdir sample_app   cd sample_app   git init   touch README   git add README   git commit -m 'first commit'   git remote add origin [email protected]:rosdabos55/sample_app.git   git push origin master 

I got all the way to the last instruction (git push origin master) without any problem. When I entered that last line into my terminal, however, I got this error message:

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

What might I be doing wrong?

Here are the contents of .git/config (reconstructed by Jefromi from the output of git config -l pasted into a comment below):

[user]     name = Ross     email = [REDACTED] [core]     editor = gvim -f     repositoryformatversion = 0     filemode = true     bare = false     logallrefupdates = true [remote "origin"]     url = [email protected]:     fetch = +refs/heads/*:refs/remotes/origin/* 
like image 674
user306472 Avatar asked Apr 11 '10 23:04

user306472


People also ask

How do I fix git push origin master?

If git push origin master not working , all you need to do is edit that file with your favourite editor and change the URL = setting to your new location. Assuming the new repository is correctly set up and you have your URL right, you'll easily be able to push and pull to and from your new remote location.

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.

Why I am unable to push the code to git?

To push a branch on remote, your branch needs to have the latest changes present in remote repository. If you get the failed to push error, first do git pull the branch to get the latest commits and then push it.

What does git push origin master mean?

git push origin master will push your changes to the remote server. "master" refers to master branch in your repository. If you want to push your changes to any other branch (say test-branch), you can do it by: git push origin test-branch. This will push your code to origin of test-branch in your repository.


1 Answers

I've stated this in the comments to another answer, but it's really the answer (and I've edited the appropriate section of the comments into the question where it belongs).

The URL for the remote was not configured correctly, for whatever reason. It's set to "[email protected]:", which is clearly missing the path, producing precisely the error you see. You need to reconfigure it correctly. You could simply edit .git/config, changing the appropriate line to contain the path. Or you could do this:

git remote rm origin git remote add origin '[email protected]:rosdabos55/sample_app.git' 

You almost certainly made some small typo or careless mistake when you added the remote the first time - perhaps you hit enter in the middle of it, perhaps you typed a space after the colon. (For some reason, git does not appear to throw an error when you provide an extra argument after remote add <name> <url> - it just ignores it.) The upshot is that you didn't actually run that command, and you added a remote with an incomplete URL.

like image 141
Cascabel Avatar answered Sep 25 '22 17:09

Cascabel