2013-07-25 123 views
0

發現我在學習的Git的過程中,也與Mac終端掙扎(我最近更改OS)文件不混帳

我在我的電腦上成功安裝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

是的,你應該提供正確的路徑'GIT中添加文件/ first_git_project/index.html'如果你在項目的根文件夾 – CharlesB

+0

@CharlesB謝謝你!這是有效的,但是我怎麼沒有早些時候添加路徑? – irm

回答

1

的Git(如許多其他工具,確實)excpect你提供了正確的道路:

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

如何移動到「first_git_project」文件夾?謝謝 – irm

+0

'cd Documents/first_git_project'('cd'是「改變目錄」) – CharlesB