如何通过 Apatana Studio 2 的 EGit 插件忽略 .gitignore 文件提交?

发布于 2024-10-31 07:16:47 字数 266 浏览 1 评论 0原文

到目前为止,我一直在使用 Git bash 进行提交,但从未见过 .gitignore 文件被提交。最近,我转向 Aptana Studio 2 来完成我的项目,并安装了 EGit Eclipse 插件 进行版本控制。每当我现在提交时,.gitignore 文件也会被提交。我什至尝试在 .gitignore 文件本身中包含行 *.gitignore ,但这没有帮助。

如何忽略 .gitignore 文件?

I have been using the Git bash for doing my commits until now and have never seen .gitignore file getting commited. Recently I moved over to Aptana Studio 2 for doing my projects and installed the EGit Eclipse Plugin for version control. Whenever I commit now the .gitignore file also gets commited. I even tried to include the line *.gitignore in the .gitignore file itself, but that doesn't help.

How can I ignore the .gitignore file?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

帅哥哥的热头脑 2024-11-07 07:16:47

.gitignore 应始终与您的项目文件一起进行版本控制,以避免其他人(或您自己在另一个系统上)意外提交文件,这可能会导致严重问题(例如包含密码的文件,..)。如果您想排除特定于您的本地环境的文件,您应该将它们放在其他地方。

http://git-scm.com/docs/gitignore

$GIT_DIR/info 中/exclude 您可以编写应被忽略且特定于该项目的文件名。在 core.excludesfile 定义的文件中,您可以放置​​应以更全局的方式忽略的文件。这两个文件(通常)都没有版本控制。

.gitignore should always be versioned with your project files to avoid, that someone else (or youself on another system) accidentally commit files, that may cause serious problems (e.g. files containing passwords, ..). If you want to exclude files, that are very specific to your local environment, you should place them somewhere else.

http://git-scm.com/docs/gitignore

In $GIT_DIR/info/exclude you can write the filenames, that should be ignored and that are specific to that project. In the file defined by core.excludesfile you can place files, that should be ignored in a more global way. Both files are (usually) not versioned.

吻泪 2024-11-07 07:16:47

您的问题的实际答案是(假设您引用的 .gitignore 文件位于项目结构的根目录中):

A.) 如果您使用的是 Windows,请确保 .gitignore 不在t 隐藏文件。在 Windows 资源管理器中右键单击该文件并选择属性,然后确保未选中隐藏。这与基于 Eclipse 的 IDE 的隐藏文件问题有关。

B.) 编辑 .gitignore 并将以下内容单独添加到一行:
/.gitignore

C.) 保存文件,然后在 Aptana 中右键单击它,然后单击团队菜单下的取消跟踪。

Egit 现在应该按预期解析文件,但不会将其添加到版本控制中。

The actual answer to your question is (assuming the .gitignore file you are referring to is in the root of your project structure):

A.) If you're using windows make sure that .gitignore isn't a hidden file. Right click on the file in Windows Explorer and select properties, then make sure hidden isn't checked off. This has to do with an issue Eclipse based IDEs have with hidden files.

B.) Edit .gitignore and add the following on a line by itself:
/.gitignore

C.) Save the file then right click on it in Aptana and click on untrack under the team menu.

EGit should now parse the file as expected but not add it to version control.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文