简体   繁体   中英

How do I add files to a git project without them being tracked?

I have downloaded a repo from github to a dev server. 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. 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). The problem is, that git now tracks the changes to that, and I still cannot do a 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). Add the path you want to exclude to the latter, and that will avoid problems pulling from the server in future.

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