git不断推送.gitignore中列出的文件

时间:2015-06-12 14:12:05

标签: git

所以我的存储库中有一个视频文件夹,其中包含一些.mp4扩展名的文件。所以我已将它们添加到.gitignore,如下所示:

的.gitignore:

.mp4

如果我理解正确,它应该忽略所有.mp4扩展名的文件。但它没有。

我已经做了下一个程序:

git rm -r --cached .

git add .

git commit -m "fixing .gitignore"

git push repositoryname master

但它仍在推送我的.mp4文件。

我该如何解决?

P.S。我的.gitignore文件位于项目的根文件夹内,而不是.git文件夹

p.s.s。我已添加*.mp4但问题仍然存在,以下是日志:

PS C:\inetpub\wwwroot\utg> git rm -r --cached .;git add .;git commit -m 'gitignore';git push utgpage mas
rm '.gitignore'
rm '.project'
rm 'README.md'
rm 'css/bounce.css'
rm 'css/parallax.css'
rm 'fonts/airbrne2.ttf'
rm 'img/logo_white_common.png'
rm 'img/overlay-pattern.png'
rm 'img/utg_logo_white.png'
rm 'index.php'
rm 'js/script.js'
rm 'js/smooth.js'
rm 'video/vid1.mp4'
rm 'video/vid2.mp4'
warning: LF will be replaced by CRLF in css/bounce.css.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in index.php.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in js/script.js.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in js/smooth.js.
The file will have its original line endings in your working directory.
[master 59dcc7f] gitignore
 3 files changed, 1 insertion(+), 1 deletion(-)
 delete mode 100644 video/vid1.mp4
 delete mode 100644 video/vid2.mp4
Counting objects: 81, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (71/71), done.
Writing objects: 100% (72/72), 129.33 MiB | 311.00 KiB/s, done.
Total 72 (delta 37), reused 0 (delta 0)
remote: error: GH001: Large files detected.
remote: error: Trace: 863068061510dfca317ad799de2a9cad
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File video/vid2.mp4 is 129.55 MB; this exceeds GitHub's file size limit of 100.00 MB
To https://github.com/Tachii/utg-frontpage.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '****'

3 个答案:

答案 0 :(得分:3)

尝试将Asterisk放在它前面:

*.mp4

点击此链接,了解有关gitignore:http://git-scm.com/docs/gitignore

的更多信息

答案 1 :(得分:2)

如果你想忽略所有的mp4文件,我相信.gitignore行将是:

*.mp4

答案 2 :(得分:1)

通过在.gitignore文件中指定.mp4,您只是指示Git忽略名为' .mp4'的文件或文件夹。 要忽略以' .mp4'结尾的所有文件,您需要添加一个通配符运算符,在本例中为星号。因此,在.gitignore文件中,使用*.mp4,将忽略名称以.mp4结尾的所有文件。