.gitignore

来源:互联网 发布:视频翻译软件 编辑:程序博客网 时间:2024/06/05 13:23

mac本上有时候会莫名其妙的多出来一个.DS_Store文件,这个.DS_Store是什么东西呢?
.DS_Store(英文全称 Desktop Services Store)是一种由苹果公司的Mac OS X操作系统所创造的隐藏文件,目的是在于存贮目录的自定义属性,例如文件们的图标位置和背景色的选择。相当于windows下的desktop.ini。

如果你的文件还没有生成.DS_Store文件的话,那么直接创建一个.gitignore忽略你不想提交到远程仓库的隐藏文件。
如果已经生成了.DS_Store,执行命令删除

find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch

1.建立.gitignore文件

vi .gitignore或者touch .gitignore

然后添加.DS_Store作为忽略的文件

.DS_Store

2.提交文件即可

git add .git commit -m 'add .gitignore'

参考资料:
http://blog.csdn.net/nunchakushuang/article/details/50511765
http://www.jianshu.com/p/fdaa8be7f6c3