'Github with vs Code wants to commit non-exisiting files
I'm facing a weird problem with github in visual studio code. I accidentally tried to commit big files to my remote repo. Then I got the [remote rejected] message.
I tried to add the folder to gitignore and unstaged with git reset HEAD^.
When committing vs code still wants to upload the big files.
Ok, so I deleted all files from the folder, unstaged again, but when I push to github it's still uploading the files and rejecting? How is this possible??
How can I get rid of that?
Solution 1:[1]
A very easy solution is to
- rename the local repository folder to something else, like
deprecated git clonethe repository, so you will have a fresh repository and the damaged repository- make the changes in the fresh clone (override the changed files, remove the deleted files)
checkoutthe branch you were ongit addwithout the large filesgit commit- remove the old, damaged copy
Alternatively, you can run
git reset --soft HEAD~1
However, the [remote rejected] might be caused by a different problem. Maybe you had multiple commits before you have pushed and the large files are not committed in your last commit. Also, it's possible that someone else pushed his/her changes and you need to pull first.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Lajos Arpad |
