.gitignore不起作用 [英] .gitignore is not working

查看:101
本文介绍了.gitignore不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 .gitignore 文件似乎被git忽略 - .gitignore 文件是否会损坏?



我的 .gitignore

  #this是注释
debug.log
nbproject /
$ b

输出来自 git status

 #分支大师
#你的分支在1次提交之前领先于'origin / master'。

#未追踪的文件:
#(使用git add< file> ...来包含将要提交的内容)

#debug .log
#nbproject /
没有添加提交,但未跟踪的文件存在(使用git add跟踪)

我想要 debug.log nbproject / 不会出现在未跟踪文件列表。



我应该从哪里开始寻找解决方案?

解决方案

固定。好的,我在Windows的记事本中创建了.gitignore文件,但它不起作用。当我在linux中查看.gitignore文件时,它看起来像是有组织的乱码 - 也许记事本写出了unicode而不是ascii或任何8位。

因此,我重写了文件放在我的linux机器上,当我把它拉回到窗口时,它工作正常!万岁!


My .gitignore file seems to be being ignored by git - could the .gitignore file be corrupt? Which file format, locale or culture does git expect?

My .gitignore:

#this is a comment
debug.log
nbproject/

Output from git status:

# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       debug.log
#       nbproject/
nothing added to commit but untracked files present (use "git add" to track)

I would like debug.log and nbproject/ not to appear in the untracked files list.

Where should I start looking to fix this?

解决方案

Fixed. Ok, I created the .gitignore file in notepad on windows and it wasn't working. When I viewed the .gitignore file in linux it looked like organised gibberish - perhaps notepad had written out unicode rather than ascii or whatever 8-bit is.

So I rewrote the file on my linux box, and when I pulled it back into windows it works fine! Hurrah!

这篇关于.gitignore不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆