Hamza Abdaoui
Hamza Abdaoui

Reputation: 2209

git status shows unexisting untracked file

I don't know if this question should be moved to ServerFault or it belongs here!

Working on a remote Unix server, I created a file file_x.php using FileZilla.

I'm using GIT on the terminal.

When I do git status, it shows me this :

On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)
  some_other_file1.php
  some_other_file2.php
   file_x.php
  ^
  |__ Note this weird blank space

The problem : I wanted to delete this file, I tried from FileZilla but this didn't work, it shows me there is no such file or directory ! But the file is always there!

So I tried :

rm -rf file_x.php       # This didn't work
sudo rm -rf  file_x.php # I'm not from the sudoers
git checkout file_x.php # This didn't do a thing !
git clear -f            # This didn't do a thing !
git rm file_x.php
==> fatal: pathspec 'file_x.php' did not match any files

My question, what does this mean ? and how do I remove this file ?

Upvotes: 1

Views: 278

Answers (1)

Matthieu Brucher
Matthieu Brucher

Reputation: 22023

You have to escape the space:

rm \ file_x.php

Upvotes: 2

Related Questions