1. Even though I’ve been using git for a few years already, there are still many unexplored corners of my favorite source-control system. Roger did a fantastically creative effort to try to simplify and clarify some core git concepts. As he puts it “no deep shit”. For slightly more advanced git candy this is a good start.

  2. 10:00 26th Apr 2011

    Reblogged from j2labs

    Tags: gitcolors

    image: Download

    j2labs:

.gitconfig tweaks
I stumbled across this stackover flow page discussing cool ways to configure your git experience. I never knew about the output coloring options and it’s changed my life already - for five minutes so far.
I recommend reading the whole page, but I recommend putting the following code at the bottom of your .gitconfig immediately. The screenshot above shows you what you get for it.
[color]        diff = auto        status = auto        branch = auto        interactive = auto        ui = true        pager = true[color "branch"]        current = yellow reverse        local = yellow        remote = green[color "diff"]        meta = yellow bold        frag = magenta bold        old = red bold        new = green bold[color "status"]        added = yellow        changed = green        untracked = cyan

    j2labs:

    .gitconfig tweaks

    I stumbled across this stackover flow page discussing cool ways to configure your git experience. I never knew about the output coloring options and it’s changed my life already - for five minutes so far.

    I recommend reading the whole page, but I recommend putting the following code at the bottom of your .gitconfig immediately. The screenshot above shows you what you get for it.

    [color]
    diff = auto
    status = auto
    branch = auto
    interactive = auto
    ui = true
    pager = true

    [color "branch"]
    current = yellow reverse
    local = yellow
    remote = green

    [color "diff"]
    meta = yellow bold
    frag = magenta bold
    old = red bold
    new = green bold

    [color "status"]
    added = yellow
    changed = green
    untracked = cyan
  3. [Tutorial] Git server on Mac OS X

    Setting up a public git repository on Mac OS has a few tricks and here’s a step-by-step
    tutorial to the rescue. I needed to set this up for my own projects and most of the information was scattered across the web.

    Let’s roll!

    On the server

    1. Install git. I’ve used both http://code.google.com/p/git-osx-installer/ and the one from Mac Ports. Both work fine.

    2. What’s your public IP? Ah, I know: http://www.whatismyip.com/
    If your server is behind a router, as in my case, you’ll need to setup port forwarding. Port 22 for SHH, to be precise.

    3. SSH is installed by default on Mac OS. It’s accessible from Terminal, you can generate keys, but it doesn’t allow other computers to connect to your server. To enable this go to System Preferences -> Sharing and from the list on the left, check “Remote Login”.
    We’ll come back here later, because it allows some more advanced settings.

    4. Create a user that will manage the repositories. The simplest way is trough System Preferences -> Accounts. Create it as an
    Administrator for now, and you can remove the Administration rights later on. It will make the installation easier. Let’s name it ‘git’ to remember it easier.

    5. Generate an SSH key by typing the following in Terminal:

    6. Setup pasword-less ssh. This is a very important step and you should not continue with the next steps if this doesn’t work.

    For this, you need to generate an ssh key from your client machine, exactly like on the previous step.

    The generated key will be a one-liner in ~/.ssh/id_rsa.pub. Copy this key to the server inside /Users/git/.ssh/authorized_keys.
    Create the authorized_keys file if it doesn’t exist already. To check the setup, from your client machine run:

    If it logs in w/o asking for a password, you’re the man! Otherwise, double check if the public key from the client corresponds with the one from the server.

    7. gitolite enters the scene.

    “Gitolite lets you use a single user on a server to host many git repositories and provide access to many developers, without having to give them real userids on or shell access to the server. The essential magic in doing this is ssh’s pubkey access and the authorized_keys file, and the inspiration was an older program called gitosis.

    Gitolite can restrict who can read from (clone/fetch) or write to (push) a repository. It can also restrict who can push to what branch or tag, which is very important in a corporate environment”


    Run the following commands in the command-line:

    As a quick walkthrough, this downloads the gitolite repository, creates some required directories and runs some config scrips.
    The path on the last line might vary, depending on how you named your user account that handles git.

    The above scripts also create a test repository in /Users/git/repositories/

    8. Do the victory dance, because you now have a git server on your Mac.

    On the client

    1. Install git, the same way you installed it on the server.

    2. Navigate in Terminal to the location where you want the repository to be and grab the test repository by running:

    3. Pushing your commits to the server might require some special settings. Since there are too many options, I won’t get into these details here. This is a link that might help: http://stackoverflow.com/questions/2816369/git-push-error-remote-rejected-master-master-branch-is-currently-checked-ou . Do remember to contribute with at least an upvote if you found the information useful. Be nice to Stackoverflow and it will be nice to you.

    Happy remote coding!