Seiten

Donnerstag, 3. Dezember 2009

Getting JUnit from Git on a Mac


I want to dig deeper into JUnit for some reasons. Therefore I want to see the latest version in the repository. JUnit uses Git. I use a Mac and never used Git before. Here's what I've done to get JUnit from Git on a Mac.

I installed Git for OS X. It's a dmg file and quite simple to install.

After that I had to add Git's bin path to PATH to use Git in the terminal. I added this to ~/.bash_profile.
export GIT_HOME=/usr/local/git
export PATH=$PATH:$GIT_HOME/bin
Worked now for me: I entered git in the terminal and saw a list of commands.

Now what? I read parts of the official Git tutorial online and in the terminal with git help tutorial. I entered my user.name and my email.adress as a key with git config --global key value where value is my name or email adress, because I should do that "before doing any operation".

I continued reading at paragraph "Using git for collaboration". There's what I was looking for:
Suppose that Alice [aka Kent] has started a new project with a git repository in /home/alice/project [aka git://github.com/KentBeck/junit.git as listed on github.com], and that Bob [aka me], who has a home directory on the same machine [aka ~/projects/junit], wants to contribute.
In the terminal I entered
git clone git://github.com/KentBeck/junit.git ~/projects/junit
Now Git downloaded JUnit. Finally JUnit was downloaded on my computer. The tutorial states that if Kent would commit changes I could be again up to date with a simple git pull.

So far so good to be able to have a look around in JUnit.

[Update: If you want to run Git within TextMate, than you can. TextMate can deal with Git from the start, but you have to set TM_GIT as a shell variable, e.g. to /usr/local/git/bin/git or wherever you've installed Git.]

4 Kommentare:

  1. Sounds … complicated.

    What I did, when I wanted to fetch the latest Groovy&Grails Textmate bundles:

    1. Installed the Git for OS X You mentioned (back then 1.6.4.4). This also added a file /etc/paths.d/git so I didn't had to add an entry to PATH, I just opened a new terminal.

    2. Executed this in the terminal:
    mkdir -p /Library/Application\ Support/TextMate/Bundles
    cd $!
    git clone git://github.com/alkemist/groovy.tmbundle.git
    git clone git://github.com/alkemist/Groovy-Grails.tmbundle.git


    That was all, nothing more needed.

    AntwortenLöschen
  2. > /etc/paths.d/git

    Right, I have the git file in that directory.

    That directory is not on my PATH. If I add it manually to and delete $GIT_HOME/bin from PATH, and if I execute git on command line, I'll end up with this:

    -bash: /etc/paths.d/git: Permission denied

    You sure you run OS X? ;)

    AntwortenLöschen
  3. AFAIK /etc/paths.d is an OS X speciality, so, yes, I do run OS X. And my installation isn't broken. Did you run some leet H4x0r "strip your OS installation by 12kb"-script from tha internets and break your OS X with that? ;-)

    /etc/paths.d is read by path_helper. Do you have /usr/libexec/path_helper ? If You run it in a shell, does the output include /usr/local/git/bin (the content of /etc/paths.d/git)?

    My /etc/profile contains the following lines. Is this the same in yours?

    if [ -x /usr/libexec/path_helper ]; then
    eval `/usr/libexec/path_helper -s`
    fi

    AntwortenLöschen
  4. AFAIK /etc/paths.d is an OS X speciality, so, yes, I do run OS X. And my installation isn't broken. Did you run some leet H4x0r "strip your OS installation by 12kb"-script from tha internets and break your OS X with that? ;-)

    /etc/paths.d is read by path_helper. Do you have /usr/libexec/path_helper ? If You run it in a shell, does the output include /usr/local/git/bin (the content of /etc/paths.d/git)?

    My /etc/profile contains the following lines. Is this the same in yours?

    if [ -x /usr/libexec/path_helper ]; then
    eval `/usr/libexec/path_helper -s`
    fi

    AntwortenLöschen