简体   繁体   中英

Would .gitignore items in the remote repository be copied in the local project repository by git clone?

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/

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM