簡體   English   中英

git繼續推送.gitignore中列出的文件

[英]git keeps pushing files that are listed in .gitignore

因此,我的存儲庫中有一個視頻文件夾,其中包含一些擴展名為.mp4文件。 所以我將它們添加到.gitignore如下所示:

.gitignore:

.mp4

而且,如果我正確理解所有內容,則應忽略所有擴展名為.mp4文件。 但事實並非如此。

我做了下一個步驟:

git rm -r --cached .

git add .

git commit -m "fixing .gitignore"

git push repositoryname master

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

我該如何解決?

ps我的.gitignore文件位於項目的根文件夾中,而不位於.git文件夾中

pss我添加了*.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 '****'

嘗試將星號放在它前面:

*.mp4

檢查此鏈接以獲取有關gitignore的更多信息: http ://git-scm.com/docs/gitignore

如果您想忽略所有mp4文件,我相信.gitignore行將是:

*.mp4

通過在.gitignore文件中指定.mp4 ,您只是在指示Git忽略名為“ .mp4”的文件或文件夾。 要忽略所有以“ .mp4”結尾的文件,您需要添加一個通配符運算符,在本例中為星號。 因此,在您的.gitignore文件中,使用*.mp4 ,所有名稱以.mp4結尾的文件都將被忽略。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM