Many of the introductory CS courses recommend the use of Eclipse. Luckily, Eclipse can be easily configured to work with your existing Git repository!
To access your Git repository through Eclipse, follow the following steps exactly:
$ ssh {your_username}@glados.cs.rit.edu
{your_username}@glados.cs.rit.edu
$ cd
$ git init --bare rit_git
.ssh
directory
(if one does not already exist):
$ mkdir -p .ssh
pico
text editor
to edit the "environment" file in the .ssh
directory:
$ pico .ssh/environment
PATH=/opt/csw/bin:/usr/bin
Ctrl-X + Y
to save.$ pwd
Window -> Open Perspective -> Other -> Git
.
Git Repositories
pane and select
Clone a Repository
from the list of options.
Finish
:
Host: glados.cs.rit.edu Repository Path: {path_from_pwd}/rit_git User: {CS_username} Password: {CS_password} Connection Type: ssh(select checkbox for
"Store in Secure Store"
)
Note: Replace {path_from_pwd}
with
the string returned by the pwd
command,
and {CS_username}
and {CS_password}
with your CS credentials.
Note: If asked about creating a
.ssh/known_hosts
file, agree to it.
Window -> Open Perspective -> Java
Package Explorer
pane, right-click on any
project folder and select Team -> Share Project
.
Next
.Finish
.
Team -> Commit
.
Commit
.
Team -> Push Branch
.
Commit and Push
.
From now on, whenever you want to send your changes to the remote repository,
you need to use this button instead of the Commit
button.
rit_git
folder
where your program files reside and verify that the file you changed
is present and correct.
This folder is where Eclipse keeps its working copy of
the version-controlled content.
When you commit through Eclipse, the commit uses this as the source
for a new version stored in the project's reposity folder under
$HOME/rit_git/
.
Note: You should never attempt to add, modify, or delete any files
in the $HOME/rit_git/
directory.
Doing so would make Git "detect" corruption
and refuse to fetch or recover your files!
The advantage of using a source code repository is that you can work on code on different machines and still keep everything synchronized. Each time you complete a coding session, just commit and push your changes to the remote repository.
Then, next time you work on a different machine, you can either check out the project (for the first time) or pull any changes from the repository.
For example, you can start an assignment on a CS lab machine, commit and push your changes, and then go home and check out the project on your personal machine to continue working right where you left off (even if you use a different operating system)!
To check out a project for the first time in Eclipse:
Window -> Open Perspective -> Other -> Git
.
Git Repositories
pane,
turn the arrow for the repository icon and the
Working Directory
down.
This will reveal all of your projects in that repository.
Import Projects
.
Alternatively, to update a project within Eclipse that is already checked out from Git:
Package Explorer
perspective,
right-click on the project folder
and select Team -> Pull
.