0

Say, If I have a git repo established in the repository ssh://user@remotehost.com:port/home/user/public_html/,

and I'd like to clone it in my local project's directory, would the appended items in my remote host's .gitignore be included in the cloning of my public_html/.git repository?

local$ git clone ssh://user@remotehost.com:port/home/user/public_html/

Jed
  • 1,664
  • 8
  • 33
  • 65

1 Answers1

1

The sole purpose of the .gitignore files is to ensure that untracked files remain untracked. The moment a file is tracked, for example when you intentionally did

git add --force path/to/ignored-file

that moment the .gitignore file lost its might over that file. So, if your remote repository contains a file that is listed in the .gitignore file, that file will still remain there in the remote repository, as well as in your clone.

alfunx
  • 3,080
  • 1
  • 12
  • 23
  • Does this mean if the ignored file was already tracked by the repo in the previous commits, then it can be cloned right? So what happens if the tracked files will be changed in the future, do the changes still be tracked even they are already been ignored? – Jed Jan 15 '19 at 07:53