简体   繁体   English

git clone是否将远程存储库中的.gitignore项目复制到本地项目存储库中?

[英]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/, 说,如果我在存储库ssh://user@remotehost.com:port / home / user / public_html /中建立了git repo,

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? 并且我想将其克隆到本地项目的目录中,是否将克隆到我的public_html/.git存储库中的远程主机.gitignore的附加项?

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. .gitignore文件的唯一目的是确保未跟踪的文件保持未跟踪。 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. 那一刻.gitignore文件失去了对该文件的控制权。 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. 因此,如果远程存储库包含.gitignore文件中列出的文件,则该文件仍将保留在远程存储库以及克隆中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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