如何使用Git修复此错误

如何使用Git修复此错误,git,git-remote,Git,Git Remote,全部, 问题是dbhandler/ipch是.gitignore的一部分,但“git push”仍在尝试将其推送到远程 还是我误解了什么,我需要做点别的 多谢各位 [编辑] 该命令失败: Igors-MacBook-Air:dbhandler igorkorot$ cat .gitignore | grep ipch dbhandler/ipch/ Igors-MacBook-Air:dbhandler igorkorot$ git rm -r dbhandler/ipch rm 'dbhan

全部,

问题是dbhandler/ipch是.gitignore的一部分,但“git push”仍在尝试将其推送到远程

还是我误解了什么,我需要做点别的

多谢各位

[编辑]

该命令失败:

Igors-MacBook-Air:dbhandler igorkorot$ cat .gitignore | grep ipch
dbhandler/ipch/

Igors-MacBook-Air:dbhandler igorkorot$ git rm -r dbhandler/ipch
rm 'dbhandler/ipch/dbinterface-19274bfe/dbinterface-5ede7563.ipch'
rm 'dbhandler/ipch/dbloader-ce428aa/dbloader-61894527.ipch'
rm 'dbhandler/ipch/dll_vc9_my_dll-b99cc480/dialogs-c6b7929.ipch'
rm 'dbhandler/ipch/docview_vc9-e1a2d063/docview-4c99da7.ipch'
rm 'dbhandler/ipch/sqlite-386a740f/sqlite-1af4ae5c.ipch'
Igors-MacBook-Air:dbhandler igorkorot$ git commit -m "Remove MSVC build files"
[master 69327de] Remove MSVC build files
 5 files changed, 0 insertions(+), 0 deletions(-)
 delete mode 100644 dbhandler/ipch/dbinterface-19274bfe/dbinterface-5ede7563.ipch
 delete mode 100644 dbhandler/ipch/dbloader-ce428aa/dbloader-61894527.ipch
 delete mode 100644 dbhandler/ipch/dll_vc9_my_dll-b99cc480/dialogs-c6b7929.ipch
 delete mode 100644 dbhandler/ipch/docview_vc9-e1a2d063/docview-4c99da7.ipch
 delete mode 100644 dbhandler/ipch/sqlite-386a740f/sqlite-1af4ae5c.ipch

Igors-MacBook-Air:dbhandler igorkorot$ git push
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

Counting objects: 401, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (323/323), done.
Writing objects: 100% (386/386), 98.53 MiB | 726.00 KiB/s, done.
Total 386 (delta 148), reused 45 (delta 13)
remote: warning: File dbhandler/docview_vc9.sdf is 58.89 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
remote: warning: File dbhandler/ipch/sqlite-386a740f/sqlite-1af4ae5c.ipch is 55.25 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
remote: warning: File dbhandler/ipch/dbinterface-19274bfe/dbinterface-5ede7563.ipch is 53.94 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: c4b823789a274ab658515b65b7b259a6
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File dbhandler/ipch/dll_vc9_my_dll-b99cc480/dialogs-c6b7929.ipch is 153.44 MB; this exceeds GitHub's file size limit of 100.00 MB
To https://github.com/oneeyeman1/dbhandler.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/oneeyeman1/dbhandler.git'

[/EDIT]

您在上一次提交中已经有了大文件。由于git的工作方式,所有文件的所有版本都必须存储在存储库中。您最好的选择是使用
git fiter branch
从历史记录中删除文件:

Igors-MacBook-Air:dbhandler igorkorot$ git filter-branch --index-filter 'git rm --cached dbhandler/ipch'
Rewrite f594d547c7f8354048d5df8b8b3e9a038b2be38a (1/97)fatal: pathspec 'dbhandler/ipch' did not match any files
index filter failed: git rm --cached dbhandler/ipch
这将获取当前分支上的所有提交并编辑它们,运行

$ git filter-branch --index-filter 'git rm --cached --ignore-unmatch dbhandler/ipch'
在每一页上。然后跑

$ git rm --cached dbhandler/ipch
$ git commit --amend
历史被改写了。请注意,这将干扰其他人处理这些提交,因为新提交虽然具有相同的描述,但与旧提交无关(类似于
git-rebase

或者,只能从某些提交中删除选定的文件:

$ git push -f

将仅在从0123abcd到HEAD(包括在内)的提交上运行。如果尚未推送0123abcd,则简单的
git推送将成功。

您在上一次提交中已经有了大文件。由于git的工作方式,所有文件的所有版本都必须存储在存储库中。您最好的选择是使用
git fiter branch
从历史记录中删除文件:

Igors-MacBook-Air:dbhandler igorkorot$ git filter-branch --index-filter 'git rm --cached dbhandler/ipch'
Rewrite f594d547c7f8354048d5df8b8b3e9a038b2be38a (1/97)fatal: pathspec 'dbhandler/ipch' did not match any files
index filter failed: git rm --cached dbhandler/ipch
这将获取当前分支上的所有提交并编辑它们,运行

$ git filter-branch --index-filter 'git rm --cached --ignore-unmatch dbhandler/ipch'
在每一页上。然后跑

$ git rm --cached dbhandler/ipch
$ git commit --amend
历史被改写了。请注意,这将干扰其他人处理这些提交,因为新提交虽然具有相同的描述,但与旧提交无关(类似于
git-rebase

或者,只能从某些提交中删除选定的文件:

$ git push -f

将仅在从0123abcd到HEAD(包括在内)的提交上运行。如果尚未推送0123abcd,则简单的
git推送将成功。

@Igor
git rm
在不删除任何文件时失败<代码>git rm--忽略不匹配
不会。看我更新的答案。好的,它起作用了。我必须添加-r,因为它是MSVC预编译头的目录。然后我做了“git推送”,现在一切都是最新的。谢谢。@Igor
git rm
在不删除任何文件时失败<代码>git rm--忽略不匹配
不会。看我更新的答案。好的,它起作用了。我必须添加-r,因为它是MSVC预编译头的目录。然后我做了“git推送”,现在一切都是最新的。谢谢。您最近更新了
.gitignore
吗?您最近更新了
.gitignore
吗?