Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/20.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.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_Github_Repository - Fatal编程技术网

在Git上找不到文件

在Git上找不到文件,git,github,repository,Git,Github,Repository,我正在学习Git,同时也在与Mac终端作斗争(我最近更换了操作系统) 我成功地在我的计算机上安装了Git,并且我能够将我的项目推送到Github,但现在我无法将我正在处理的同一个文件(index.html)添加到下一次提交中,并出现以下错误: fatal: pathspec 'index.html' did not match any files html在同一个文件夹中,所以我必须更改git设置,但我不知道如何重新建立我所拥有的 这是我可以用git config修复的吗?我需要包括文件的路径

我正在学习Git,同时也在与Mac终端作斗争(我最近更换了操作系统)

我成功地在我的计算机上安装了Git,并且我能够将我的项目推送到Github,但现在我无法将我正在处理的同一个文件(index.html)添加到下一次提交中,并出现以下错误:

fatal: pathspec 'index.html' did not match any files
html在同一个文件夹中,所以我必须更改git设置,但我不知道如何重新建立我所拥有的

这是我可以用git config修复的吗?我需要包括文件的路径吗

如果我输入git status,我会得到以下不正确的结果

On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   modified:   Documents/first_git_project/index.html
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   .CFUserTextEncoding
#   .DS_Store
#   .Trash/
#   .bash_history
#   .bash_profile
#   .bashrc
#   .cups/
#   .git-completion.bash
#   .gitconfig
#   .npm/
#   .nvm/
#   .ssh/
#   .viminfo
#   Desktop/
#   Documents/.DS_Store
#   Documents/.localized
#   "Documents/I\342\200\231m in the process of learning Git and working with the Mac Terminal.docx"
#   Documents/Microsoft User Data/
#   Documents/RDC Connections/
#   Documents/Symfony_quick_tour_2.2.pdf
#   Documents/Terminal Cheatsheet for Mac.docx
#   Documents/first_git_project/ first_file.txt
#   Documents/first_git_project/.DS_Store
#   Documents/first_git_project/css/
#   Documents/first_git_project/fancybox/
#   Documents/first_git_project/font/
#   Documents/first_git_project/img/
#   Documents/first_git_project/imgs/
#   Documents/first_git_project/js/
#   Downloads/
#   Library/
#   Movies/
#   Music/
#   Pictures/
#   Projects/
#   Public/
#   SublimeProj/
#   kno-engage-ui/
no changes added to commit (use "git add" and/or "git commit -a")
isaiass-MacBook-Pro:~ isaias$ 
分支主机上的

#未为提交而暂存的更改:
#(使用“git add…”更新将提交的内容)
#(使用“git签出--…”放弃工作目录中的更改)
#
#修改:Documents/first\u git\u project/index.html
#
#未跟踪的文件:
#(使用“git add…”包含在将提交的内容中)
#
#.CFUserTextEncoding
#.DS_商店
#.垃圾/
#.bash_历史
#.bash_简介
#巴什尔先生
#.杯子/
#.git-completion.bash
#.gitconfig
#.npm/
#.nvm/
#.ssh/
#.viminfo
#桌面/
#文档/.DS\u存储
#文档/。本地化
#“Documents/I\342\200\231m正在学习Git并使用Mac Terminal.docx”
#文档/Microsoft用户数据/
#文档/RDC连接/
#文件/Symfony\u quick\u tour\u 2.2.pdf
#Mac.docx的文件/终端备忘单
#Documents/first\u git\u project/first\u file.txt
#Documents/first\u git\u project/.DS\u Store
#文件/首个git项目/css/
#文件/首个git项目/fancybox/
#文档/首个\u git\u项目/font/
#文件/首个git项目/img/
#文件/首个git项目/imgs/
#文件/第一个吉特项目/js/
#下载/
#图书馆/
#电影/
#音乐/
#照片/
#计划/
#公开的/
#升华计划/
#kno-engage用户界面/
未向提交添加任何更改(使用“git add”和/或“git commit-a”)
isaiass MacBook Pro:~isaias$
Git(与许多其他工具一样)希望您提供正确的路径:

git add Documents/first_git_project/index.html #if you're in the project root folder

是的,如果您在项目根目录中,您应该提供正确的路径
git add Documents/first\u git\u project/index.html
folder@CharlesB谢谢你,伙计!这是可行的,但为什么我之前添加时没有路径?如何移动到“first\u git\u project”文件夹?感谢
cd文档/first\u git\u项目
cd
是“更改目录”)