Adding eclipse project to github

Following are the steps to add projects to github . Though i have written this for eclipse projects, actually this works for any projects.

1. I assume you are having git installed in your pc, else first download and and install git from here .

2. Browse to your project folder and type

git init

3. Now let git know where you want to send your content. Type the following

$ git remote add origin https://github.com/[GIT user id]/[projectName].git

4. Now that git knows where you want to send your project , another 3 simple things you have to do. Add the actual project, commit to local git and finally replicate the change to github.

git add .   # this adds all the files
git commit -a -m "Initial commit" # this is for local commit. 

git push -u origin --all # finally :)

5. Remember git will ask for your github user id and password.

Commit to Github

Here are simple steps (only commands) to install ,setup a repo and commit to github . I assume that you are having root access(These instructions are from linux only. ) and a github account .

  1. Go to the folder containing code , which you want to commit.
  2.  sudo apt-get install git   # install git
  3. Next step is to setup github with your detailsmonai@monai:~/imraw$ git config –global user.name “Your name”
    $ git config –global user.email ” your mail ”
    $ git config –global credential.helper cache   # to remember password
  4. Next step is to add files to repo
    git add *
  5. Now we are ready to commmit changes
    git commit *
  6. In case you get any fatal error regarding creation of index.lock , userm -f ./.git/index.lock
  7. Now we are ready to push our changes to github.com
    $ git remote add origin https://github.com/yourname/projectname.git
    $ git push origin master
  8. That’s it. Remember you can always use force , in case you encounter some error and you know the system is wrong 🙂