Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git 吉特->;致命:您当前的分支机构';硕士';还没有任何提交_Git - Fatal编程技术网

Git 吉特->;致命:您当前的分支机构';硕士';还没有任何提交

Git 吉特->;致命:您当前的分支机构';硕士';还没有任何提交,git,Git,如果我已经运行了git日志,为什么在运行git日志时git会显示此消息 git init git添加。 git提交-m“首次提交” 执行git add不会添加任何内容。您需要至少有一个pathspec(路径规范)(大致上,它表示任何表示要添加的文件或目录类型的内容)。pathspec的示例有,*,dir1/dir1/one.c等。您在执行git add时一定遇到了此错误: hint: Maybe you wanted to say 'git add .'? hint: Turn this mes

如果我已经运行了git日志,为什么在运行git日志时git会显示此消息

git init
git添加。
git提交-m“首次提交”

执行git add不会添加任何内容。您需要至少有一个
pathspec
(路径规范)(大致上,它表示任何表示要添加的文件或目录类型的内容)。pathspec的示例有
*
dir1/
dir1/one.c
等。您在执行
git add
时一定遇到了此错误:

hint: Maybe you wanted to say 'git add .'?
hint: Turn this message off by running
hint: "git config advice.addEmptyPathspec false"
此消息表示您可能想执行一个
git添加。
。这意味着它将添加它认为已更改的任何内容

运行
git commit-m“first commit”
时,您必须:

On branch master

Initial commit

nothing to commit (create/copy files and use "git add" to track)
它还说,它没有什么可承诺的,这意味着你从一开始就没有承诺过任何事情。 最后运行
git日志
,您将得到:

fatal: your current branch 'master' does not have any commits yet
这证明了现在发生的一切都是正确的。 我希望这能解决你的问题!:)


最好的

问题是您没有添加任何内容,甚至可能没有要提交的更改,因此没有执行提交。如果确实希望第一次提交时不做任何更改,可以执行以下操作:

git commit --allow-empty -m "first commit"
否则,一旦要进行更改(例如新文件),请使用:

git add .

在提交之前将其暂存。

您是否执行了
git add
git add.
?如果您没有使用
,那么您实际上没有添加任何内容。upsss,我编辑了这篇文章,正确的是
git add。
我认为问题在于git配置和windows 10 home有些错误,因为在我的另一台pc上工作正常(win10 pro),因为在我执行了
git add.
之后,我没有看到任何确认消息,与
git commit-m“firts commit”
发生了相同的情况,只需经过几秒钟,并且只有terminal empty的提示