Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing bin executable folder from GitHub

Tags:

git

github

I accidentally pushed the bin folder of my Java program to GitHub, and now I wish to remove all those .class files.

How can I do that?

like image 237
Alexander Mills Avatar asked Feb 07 '15 23:02

Alexander Mills


People also ask

How do I remove a git bin file?

InfoQ: The basic way to remove a binary or other improper file from git is to use the git-filter-branch command.

How do I remove a folder from GitHub?

Browse to the directory in the repository and branch that you want to delete. In the top-right corner, click "…", and then Delete directory. Review the list of files. Depending on your permissions and the branch protection rules, choose to either commit the change directly or propose the change using a pull request.

What is bin folder in GitHub?

/bin is usually a folder that contains binary files or compiled stuff in general. You should never put it in a repo. It's not dangerous, but it wastes space and it's something that has to be compiled in each one's computer anyway, so it's pointless to put them in the repo :) Follow this answer to receive notifications.

How do I remove old files from GitHub?

Delete Files using git rm. The easiest way to delete a file in your Git repository is to execute the “git rm” command and to specify the file to be deleted. Note that by using the “git rm” command, the file will also be deleted from the filesystem.


1 Answers

First, you should create a commit that removes this folder from git:

$ git rm -r bin
$ git commit -m "Removed bin folder"
$ git push origin master

After doing that, you can ensure this mistake won't happen again by adding the bin directory to your .gitignore file, and commit that change too:

$ echo "bin/" >> .gitignore
$ git add .gitignore
$ git commit -m "Added bin folder to gitignore"
$ git push origin master
like image 119
Mureinik Avatar answered Oct 07 '22 00:10

Mureinik