简体   繁体   中英

Can't seem to be able to delete from the local GIT repository

I don't seem to be getting it. From this page I'm trying to correct a commit where I had added a build folder with large files.

I've deleted the folder from the local disk. I've:

$ git add -u
$ git commit

But when I push, I get a too big file error, two .pdb's are still in the local git. But I can't see them any longer with a:

$ git status

I've done a:

$ git ls-tree --full-tree -r HEAD
The `.pdb` file or `Debug` folder is not on the list.

I've tried every variation of what I can find on the web, no luck. The push in part:

$ git push origin master

or just

$ git push

and:

Counting objects: 499, done.
remote: warning: File project/Debug/CAD.pdb is 68.07 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
remote: warning: File project/Debug/vc141.pdb is 66.48 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.

Yet when:

$ git rm --cached -r ./project/Debug
fatal: pathspec './project/Debug' did not match any files

or even:

$ git rm --cached ./project/Debug/CAD.pdb
fatal: pathspec './project/Debug/CAD.pdb' did not match any files

$ git commit -m "deleted files"

On branch master
Your branch is ahead of 'origin/master' by 2 commits.
  (use "git push" to publish your local commits)
nothing to commit, working tree clean

Yet it keeps showing up in the git push .

using git version 2.9.2.windows.1 Thanks, Dan.

git status says you have 2 commits that aren't in origin/master . One of them must be adding the file and the other must be deleting it.

You can check by running git log --stat origin/master..master , which shows the commits that aren't on GitHub, and the filenames they change.

You can combine the two commits into one by running git rebase -i origin/master and changing the start of the second line from pick to squash , meaning squash the later commit into the earlier commit.

Then, try pushing again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM