I usually add an existing project to Github using the following documentation.. https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
The documentation also says.. To avoid errors, do not initialize the new repository with README, license, or gitignore files. You can add these files after your project has been pushed to GitHub.
So now when I push the changes for the first time all the unnecessary jar files/target directory/ide files get pushed. I then manually exclude those files by adding .gitignore like this..
$ echo '.idea' >> .gitignore
$ git rm -r --cached .idea
$ git add .gitignore
$ git commit -m '(some message stating you added .idea to ignored entries)'
$ git push
- Can I prevent adding all these unneeded files first time itself?
- After deleting the unneeded files (target,jar,ide files) and adding them to .gitignore, I have verified that they no longer exist in github, but when I clone the url its still 100MB, the actual download size is however less than 1MB? Can someone clarify this.