Home > technology > GIT (github) in Eclipse 3.5

GIT (github) in Eclipse 3.5

November 3, 2010

GIT is a distrubuted version control system. Github is a commercial cloud based GIT service, but has free accounts. Its somewhat different from CVS and Subversion and so on, because theres no central code repository…

On GitHub you

  1. get (branch/fork/copy) a complete copy of a source code repository you want to work with, then
  2. clone that locally so you make changes independently. Your changes are merged into your clone.
  3. Then you push the local merge back up to GitHub.
  4. others (perhaps the owner of the original repo you forked) can do a “pull request” into their repo and merge the changes in.

So in a bit more detail then :

  • Get eGit plugin
  • Create a github account
  • Fork the repository you want to work with (use the fork button on github when you login and navigate to your selected repo)
  • In eclipse Git Repositories view Clone the fork – create an eclipse project using it if you can
  • Create a second remote that points to the repository you forked from (a read only url) – you’ll push up to this when you merge your code into the read-write fork
  • Make your code changes – update the source files in the project that is based on the fork, or Copy/Paste from a project based on the fork
    • Team->Add the files you updated, then
    • Team->commit
  • Now, you need to push –
    • Create SSH keys and add to github in “Your Account” on github – generate in Eclipse-Window->Preferences->Network Connections->SSH2 (user a passphrase as well) then paste into the form on github.
    • I had to resart eclipse to pick up my keys
    • From your project or package choose Team>Push. Use ssh as the method on a custom url
      • ssh://git@github.com/username/RepositoryName.git
    • for the free github accounts leave the username as git and password field blank.
    • you’ll be prompted for your passphrase
    • you should then be able to pick your local branch and the remote you want to push to. Do this and add the “spec”. Then push !
  • Now, if you want others to have a chance to get your code – send a pull request
Advertisements
Categories: technology Tags: , , , , ,
%d bloggers like this: