我正在创建一些新文件,我正在尝试添加它们但是当我使用git add applications/libraries/calendarclass.php它时,它将无法识别我有一个文件
我刚刚在textmate中创建了该文件并且正在盯着它.如何将其添加到git?
releventz$ git add application/libraries/calendarclass.php
fatal: pathspec 'application/libraries/calendarclass.php' did not match any files
releventz$ ls
application css index.php license.txt
authnet images js system
releventz$ cd application
application$ ls
cache controllers errors hooks language logs third_party
config core helpers index.html libraries models views
application$ cd libraries
libraries$ ls
MY_Unit_test.php index.html loginclass.php
libraries$ git branch
* master
libraries$ git add calendarclass.php
fatal: pathspec 'application/libraries/calendarclass.php' did not match any files
Run Code Online (Sandbox Code Playgroud)
我用的时候 git status
libraries$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 2 commits.
#
nothing to commit (working directory clean)
Run Code Online (Sandbox Code Playgroud)
添加新文件后,键入:
git status
Run Code Online (Sandbox Code Playgroud)
然后,您应该看到准备添加的文件 - 然后键入git add (filename)或者git add .如果要添加所有文件.
如果touch文件不能解决问题,您可能需要查看一下,.gitignore以确保那里没有有趣的业务,例如排除所有或类似的东西.
从您的输出,它看起来calendarclass.php不存在.如果要创建文件,然后将其添加到git,请执行以下操作:
touch calendarclass.php
git add calendarclass.php
Run Code Online (Sandbox Code Playgroud)