我正在学习Git并且还在与Mac终端进行斗争(我最近更改了操作系统)
我在我的计算机上成功安装了Git并且我能够将我的项目推送到Github但是现在我无法添加相同的文件(index.html)我正在处理我的下一次提交并得到了错误的错误:
fatal: pathspec 'index.html' did not match any files
index.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$
答案 0 :(得分:1)
Git(确实有许多其他工具)希望您提供正确的路径:
git add Documents/first_git_project/index.html #if you're in the project root folder