git push origin master失败并给出错误:src refspec HEAD与any不匹配

时间:2013-01-21 19:02:52

标签: git

任何帮助都会很棒。提前谢谢!

我安装了git,并设置了ssh密钥,但是我收到了这个奇怪的错误。

admin@Administrators-MacBook-Pro:~/Desktop$ cd exercise/
admin@Administrators-MacBook-Pro:~/Desktop/exercise$ git init
Initialized empty Git repository in /Users/admin/Desktop/exercise/.git/
admin@Administrators-MacBook-Pro:~/Desktop/exercise$ git remote add origin git@github.com:pavankat/exercise.git
admin@Administrators-MacBook-Pro:~/Desktop/exercise$ git push origin master
error: src refspec master does not match any.
error: failed to push some refs to 'git@github.com:pavankat/exercise.git'
admin@Administrators-MacBook-Pro:~/Desktop/exercise$ git push git@github.com:pavankat/exercise.git HEAD:test
fatal: remote part of refspec is not a valid name in /
admin@Administrators-MacBook-Pro:~/Desktop/exercise$ git push git@github.com:pavankat/exercise.git HEAD:test
error: src refspec HEAD does not match any.
error: failed to push some refs to 'git@github.com:pavankat/exercise.git'
admin@Administrators-MacBook-Pro:~/Desktop/exercise$ 

1 个答案:

答案 0 :(得分:13)

所以我没有做

git add .

git commit -am 'initial commit' 
在我推开之前

:/