我有一个奇怪的问题:
$ cd ~/htdocs
$ mkdir test
$ cd test
$ git init
Initialized empty Git repository in /home/deep/htdocs/test/.git/
$ git checkout master
error: pathspec 'master' did not match any file(s) known to git.
$ git checkout -b master
fatal: You are on a branch yet to be born
$ git checkout origin/master
error: pathspec 'origin/master' did not match any file(s) known to git.
$ git branch -a
(empty this)
Run Code Online (Sandbox Code Playgroud)
但这是新的本地空回购.主分支在哪里?
Wan*_*uta 31
和往常一样,Git是对的,它只是有一种古怪的说法:当你创建一个存储库时,master分支实际上还不存在,因为它没有任何东西可以指向它.
你有没有尝试过一些事情git init
?当然,添加遥控器并从中拉出它也会起作用.
小智 6
我和你有同样的问题。我解决的方法是创建一个新的空文件只是为了在项目中有一个文件。
git add someFile
然后commit -m "first commit"
和最后push origin master
我希望它有帮助
归档时间: |
|
查看次数: |
41387 次 |
最近记录: |