Difference between revisions of "Eclipse and Git"

From Redbrick Wiki
Jump to navigation Jump to search
Line 1: Line 1:
 
So after having a bit of a head bashing session getting an eclipse project to work nicely with a git repository hosted on github, I thought I'd throw my approach up here to save others torture.
 
So after having a bit of a head bashing session getting an eclipse project to work nicely with a git repository hosted on github, I thought I'd throw my approach up here to save others torture.
  
== Eclipse git plugin ==
+
==Eclipse git plugin==
 
I'm using EGit.
 
I'm using EGit.
  
 
I used Eclipse's Update Manager, adding http://download.eclipse.org/egit/updates as the site for the plugin.
 
I used Eclipse's Update Manager, adding http://download.eclipse.org/egit/updates as the site for the plugin.
  
== Eclipse Project ==
+
==Eclipse Project==
 
I went about setting up my project in eclipse as per usual, noting the location of my workspace.
 
I went about setting up my project in eclipse as per usual, noting the location of my workspace.
  
== Git Repo ==
+
==Git Repo==
 
I'm using ubuntu, so I installed the necessary git tools with the following command:
 
I'm using ubuntu, so I installed the necessary git tools with the following command:
  

Revision as of 23:06, 9 November 2010

So after having a bit of a head bashing session getting an eclipse project to work nicely with a git repository hosted on github, I thought I'd throw my approach up here to save others torture.

Eclipse git plugin

I'm using EGit.

I used Eclipse's Update Manager, adding http://download.eclipse.org/egit/updates as the site for the plugin.

Eclipse Project

I went about setting up my project in eclipse as per usual, noting the location of my workspace.

Git Repo

I'm using ubuntu, so I installed the necessary git tools with the following command:

sudo apt-get install git-core

I then opened a terminal and cd'd to the location of my project in the eclipse workspace, noted above.

cd /home/dregin/workspace/Project-Name/

I then set up a .git repo following the steps provided by github, here.

git config --global user.name "My Name" git config --global user.email email@address.com

NOTE: At this point the steps want you to create/move into a directory, but we're already in the directory we're going to use.

git init git add . git commit -m 'My first commit' git remote add origin git@github.com:username/repository-name.git push origin master NOTE: If this isn't your first commit to the repository you plan on using you should merge with the remote repository as follows: git fetch origin git merge origin/master push origin master