1

Before this is questioned, I've browsed 4 similar threads that have not answered my question yet, so I'm posting now.

I'm doing a project through One Month Rails, have set up Git and GitHub without any problem until I go to do the following:

$ git push -u origin master

Then I got this output (originally):

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

Based on another SO thread, I tried these two commands:

$ git remote rm origin
$ git remote add origin 'git@github.com:rubymal/pinteresting.git'

I tried again:

$ git push -u origin master

Output:

error: src refspec master does not match any.
error: failed to push some refs to 'git@github.com:rubymal/pinteresting.git'

What could be the problem?

Mallory
  • 41
  • 6
  • Did you try [this answer](http://stackoverflow.com/a/7572252/456814)? –  Apr 02 '14 at 00:11
  • When you get this error: "No path specified. See man git-pull for valid url syntax." Check to see if you have typed something wrong in your repository URL. – Keith OYS May 15 '14 at 09:25
  • Duplicate of [src refspec master does not match any when pushing commits in git](http://stackoverflow.com/q/4181861/456814). –  Jun 17 '14 at 16:43

1 Answers1

3

You should at least have one committed file in your working directory before pushing a commit on Github.

The git add command adds a change in the working directory to the staging area. It tells Git that you want to include updates to a particular file in the next commit.

$ git add .

Next, the git commit command commits the staged snapshot to the project history.

$ git commit -m 'First Commit'

NOTE: You must commit the staged files before pushing to the git repository. Your problem is associated with this particular step.

Finally, git push is how you transfer commits from your local repository to a remote repository.

$ git push origin master
Kirti Thorat
  • 52,578
  • 9
  • 101
  • 108
  • Followed the above and it's looking like it worked! Thank you! – Mallory Apr 02 '14 at 00:41
  • Glad to help:) Please accept the answer when you get a chance. – Kirti Thorat Apr 02 '14 at 01:24
  • @KirtiThorat so is the problem that the original poster was using an SSH url instead of HTTPS, or was it that she hadn't made any commits in her new repo yet? –  Apr 02 '14 at 04:05
  • @Cupcake No, its not. Its just a preference. Added more detailed explanation in the answer. Please review and update, if necessary. – Kirti Thorat Apr 02 '14 at 13:35
  • According to [this answer](http://stackoverflow.com/a/7572252/456814), all you really have to do is to make an initial commit before pushing. All the other stuff about removing and then re-adding your remote should be unnecessary. –  May 22 '14 at 17:59
  • @Cupcake The extra steps were given to just start with a clean state, nothing else. But I guess, I received down vote for the clean state. So, here is the clean answer. – Kirti Thorat May 22 '14 at 18:16