Convert an Eclipse Project to a Git repository and push up to GitHub
Navigate the Eclipse project and open a gitBash window Open the project folder inside of the Eclipse Workspace Workspace has .Metadata and project folder in it Project folder has .classpath .settings src etc Open gitBash in that folder For Windows: right click in file explorer inside the open folder pane.
Convert folder to git repository Add an empty .gitignore file using the command: git touch .gitignore Open .gitignore in a text editor and edit it as required by the project file structure
Example .gitignore file # Ignore everything * # But not these files... !.gitignore !src !src/ !src/** !libs !libs/ !libs/** !Maps !Maps/ !Maps/** !*.txt !*.md # MAC HIDDEN FILES .DS_Store This example starts by ignoring everything. Files and folders that are to be tracked are included by putting the ‘!’ before the descriptor. This tells git to not ignore these files/folders
Initialize the folder to convert to a repository using >git init This will add the .git hidden folder to the project
Convert Project folder into Git repository git init add a .gitignore (edit the .gitignore) git add . git commit -m “first commit” Make an empty repository on GitHub Push project upstream