[英]How do I add files to a git project without them being tracked?
I have downloaded a repo from github to a dev server. 我已经从github下载了一个仓库到开发服务器。 The repo does not have a media/ dir. 回购没有媒体/目录。 I copied the media/ folder from the live site to the dev site, however, git picked it up. 我将媒体/文件夹从实时站点复制到了开发站点,但是,git选中了它。 So now when I try to pull files, I'm out of sync. 所以现在当我尝试拉文件时,我不同步了。
So I added media/ to the .gitignore file (which is in VC). 因此,我将媒体/添加到了.gitignore文件(在VC中)。 The problem is, that git now tracks the changes to that, and I still cannot do a git pull. 问题是,git现在跟踪该更改,而我仍然不能执行git pull。
This server will only ever pull files. 该服务器将仅提取文件。
What's the best way to handle this problem? 解决此问题的最佳方法是什么?
So as I understand it, you want to exclude a directory from version control in your own private copy of a repo. 因此,据我所知,您想从版本控制中将目录排除在您自己的仓库的私有副本中。 This is easy: there are two places that Git looks for paths to ignore, the .gitignore
file (which is usually tracked in the project commit history), and .git/info/exclude
(which is private to your copy of the repo). 这很容易:Git在两个地方寻找要忽略的路径, .gitignore
文件(通常在项目提交历史记录中进行跟踪)和.git/info/exclude
(这是您的存储库副本专用的) 。 Add the path you want to exclude to the latter, and that will avoid problems pulling from the server in future. 将要排除的路径添加到后者,这样可以避免将来从服务器拉出问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.