Adding a new developer to your Git Repository

First of all, this is just a walkthrough for Windows!

 

1. Download and install Git. I prefer the installation without msysGit

image

2. Install Git. Make sure you have admin rights (for example if you’re using the UAC). Here are my recommended settings:

 

image

image

image

 

3. Setup your git config. You should set at least the following two configuration settings:

git config -–global user.name “your name”

git config -–global user.email “your email”

You have to enter this commands in the Git Bash! After finishing, there should be a “.gitconfig” file in your user directory.

image

Here are some recommendations of mine. Feel free to just copy and paste it:

[alias]
    review = log -1 –patch
    unstage = reset head
    aa = add –all
    au = add –update
    s = status
    p = pull
    l = log –oneline -10
    k = !gitk –all & –all &
    aua = !git add –update && git commit –amend –reuse-message=HEAD
    aaa = !git add –all && git commit –amend –reuse-message=HEAD
    amend = commit –amend –reuse-message=HEAD
    aucp = !sh -c ‚git add –update && git commit -m \"$1\" && git push‘ –
        aacp = !sh -c ‚git add –all && git commit -m \"$1\" && git push‘ –

    autosetupmerge = true
    autosetuprebase = always
[color]
    ui = auto
    wtf = true
[color "diff"]
    old = bold red
    new = bold green
    meta = bold yellow
[color "branch"]
    current = black green
    local = bold green
    remote = yellow
    plain = bold yellow
[color "status"]
    added = bold red
    changed = bold green
    untracked = bold cyan
    nobranch = red reverse
[color "interactive"]
    prompt = bold green
    error = bold red

4. Generate the RSA Keys by entering the following command in the bash shell:

ssh-keygen –C “your name” –t rsa –v

Be careful: Don’t enter a filename as it won’t generate the needed .ssh directory in your user dir! Read more in this article.

image

If the operation was successful, you will find the private and public keys in your user directory in the invisible direcotry “.ssh”. It’s important that the filenames are “id_rsa” and “id_rsa.pub” because Git is using by convetion these files to access the server.

5. Copy the “known_hosts” file from a co-worker and put it into your .ssh directory.

6. Add your public key to the remote git server. In my case, i have a local copy of the gitolite-admin directory on the server.  So all i have to do is adding the new public key to the “keydir” directory and edit the “gitolite.conf” file in the “conf” directory:

 

image

7. Create a local copy of the development repository:

git clone git@ci:WebDevelopment.git

WebDevelpment.git is the name of the repository and ci is the server name. Make sure you are in the directory where you want to create the clone!

 

8. Some more references

http://help.github.com/win-set-up-git/

http://kylecordes.com/2008/git-windows-go

 

9. Think about using symbolic links for the “.ssh” dir and the “.gitconfig” file. You can use the mklink command from windows. I use this way to sync all my machines.

Mit Tag(s) versehen:

Schreibe einen Kommentar

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

WordPress.com-Logo

Du kommentierst mit Deinem WordPress.com-Konto. Abmelden / Ändern )

Twitter-Bild

Du kommentierst mit Deinem Twitter-Konto. Abmelden / Ändern )

Facebook-Foto

Du kommentierst mit Deinem Facebook-Konto. Abmelden / Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden / Ändern )

Verbinde mit %s

%d Bloggern gefällt das: