I appreciate the effort you have put into this, but unfortunately, it is wrong.
1. Do not put the .metadata folder under version control.
- it is not required
- (despite what you say) it is not portable to other computers as, amongst other things, it contains hardcoded paths that are specific to your computer
- it contains huge amounts of information that will severely bloat your repository. For example, it includes every change you make to you source files (much like a source repository does) - this is how all of the 'Local History' functions work
2. You'll find it is MUCH easier to use the eGit Eclipse plugin. This integrates git directly into your Eclipse (LPCXpresso, MCUXpresso etc) so you never need to use the command line. This is a good eGit tutorial: EGit Tutorial from EclipseSource
Note: I guess the reason you thought you needed to include .metadata is that it contains details of the projects in your workspace. The correct way to let a workspace know about a project is to use the File-> Import.. Existing projects into Workspace
I hope this helps you use git in the correct way in Eclipse.