1. Go to https://github.com/.
2. Create an account or use your existing account.
3. Create a new Repository.

4. Click “Create Repository” to create the repository.

5. Go to https://git-scm.com/downloads.
6. Download and install GIT.

7. Open Command Prompt and type git –version to confirm that it is installed properly.

8. Create a Force.com Project using Force.com IDE in Eclipse.
9. Go to Team –> Share Project.

10. Click Create.

11. Click “Finish”.

12. Right Click the GIT Repository folder selected in 11th step and select GIT Bash Here.

13. Execute the below commands one by one. Do not just copy and paste.
git init
git add MySFDCDevOrg
git config user.email “your email id “
git config user.name “You Name”
git commit -m “first commit”
gt remote add origin https://github.com/magulan/MyDevOrg.git
git push -u origin master
14. Enter your github credentials when prompted.

15. Go to GITHUB and verify.

How to Commit Changes to Git from Force.com IDE in Salesforce?