gitgit-addgit-statusgit-untracked

how can i add one of my file in the .gitignore file?


I'm new to coding.

I learned about the .gitignore file today, and I succeeded in adding an unwanted file to the .gitignore file but could not add one file on the .gitignore file.


Untracked files:
  (use "git add <file>..." to include in what will be committed)
    ".zcompdump-Young\342\200\231s MacBook Pro (3)-5.8.1"
    git/

I don't want this file to be on my untracked file list.

How can I include this in the .gitignore file?

Why isn't this file included in .gitignorefile as other files?

I was able to add these files in the .gitignore file.

.zshrc
.python_history
.stCommitMsg
.subversion/
.viminfo
.vscode/
Applications/
Creative Cloud Files/
Desktop/
Documents/

and when I enter git status commend these files weren't not appeared in the untracked list.

What am I doing wrong? How can I add it to the .gitignore file?


Solution

  • If you're having to ignore Applications, Desktop and Documents, it looks like you're on a Mac and that you've initialized a Git repository in your home directory.

    Don't do that.

    Create a subdirectory (call it Development for all I care) and put your projects in subdirectories of that one. Then you initialize a Git repository per project directory.

    Then delete the .git directory from your home dir.