我真的卡在这个问题上了。我已经搜索了很多,但还是无法弄清我做错了什么...
我正在尝试通过终端的git add README.txt
命令创建一个新文件...
(到目前为止,我已经创建了一个名为Fundamentals
的新文件夹,创建了一个子文件夹git-practice
,并通过git init
命令创建了一个git仓库)
然而,当我尝试在fundamentals/git-practice
中添加文件时,出现以下错误:
fatal: pathspec 'README.txt' did not match any files
不确定我做错了什么.. 一切似乎都很合理。 这是代码:
Reenas-MBP:~ reenaverma$ cd ~
Reenas-MBP:~ reenaverma$ ls
72.png GitHub flask-workshop
Applications Library fundamentals
Creative Cloud Files Movies funny_things
Desktop Music get-pip.py
Documents Pictures world
Downloads Public wwlc
Dropbox Retrieved Contents
Reenas-MBP:~ reenaverma$ cd fundamentals
Reenas-MBP:fundamentals reenaverma$ ls
git-practice
Reenas-MBP:fundamentals reenaverma$ cd git-practice
Reenas-MBP:git-practice reenaverma$ ls -a
. .. .git
Reenas-MBP:git-practice reenaverma$ pwd
/Users/reenaverma/fundamentals/git-practice
Reenas-MBP:git-practice reenaverma$ git add README.txt
fatal: pathspec 'README.txt' did not match any files
Reenas-MBP:git-practice reenaverma$
README.txt
的文件吗?如果你正在使用git bash
,在存储 git 仓库的目录中输入ls
命令可以查看有哪些文件。 - Code-Apprenticeecho "# git-practice" >> README.txt
,然后执行git add README.txt
。 - Vladimir Glinskikh