Hi,
I want to tell you how to use Git a little more in detail because I found it pretty hard to get it going at first. Firstly, I may translate this to German at another point but I will keep this in English for now because I want some of my team mates to be able to enjoy this as well. Please note that this guide will focus on how to use Git on a Windows plattform locally and
CodeBase and/or
SourceForge.net remotely. However, you should be able to take this guide as a hint how to do it on other sites. This guide is not entirely from the scratch, I finally worked it all out with the help of
this great guide from Drew Blas. That means to say this guide will at least be based on that guide a little.
Now, to get this going you will need some software, right? There is some software available. I personally got myself
TortoiseGIT which is available for x86 (32 Bit) and x64 (64 Bit) Windows systems and is just like other Tortoise programs integrated in the Windows Explorer. The second program i got myself can actually be called a bundle because it has two programs that help you accessing your repositories. It is called
msysgit and contains a program called Git Bash, which is a command line approach to Git, and Git GUI which apparently is a GUI based approach to Git. Just to tell you, I use TortoiseGIT and Git Bash to do what I need to do.
The last thing you will need to run all these programs on Windows is
PuTTY. Be sure to use get the full package so either the .zip with all binaries or the Windows installer. Well, I think you can do the install alone. If you install PuTTY first you can point to its directory when installing msysgit and skip some of the next step. Also note that it is advisable to install TortoiseGit last. The install order in short:
PuTTY --> msysgit --> TortoiseGit
The next thing you want to be doing is make sure everything is well integrated with each other. So first open the
TortoiseGIT settings (you can do this via the Start Menu or by simply right clicking on any given folder, opening the TortoiseGit submenu and click on the Settings item). Next go to the
Network item and browse to the putty.exe of the putty package you installed earlier. Apply changes and we proceed with integrating PuTTY into msysgit. If you entered the proper path to PuTTY when installing msysgit earlier you can skip the following. Anyway, you can still check if it is set correctly following the rest of this step. I will quote
Drew Blas'es Guide here:
Zitat:
- In Windows (XP) Press WindowsKey + Pause/Break or double-click System in the Control Panel
- Under the Advanced tab click Environment Variables
- Under user variables (the top set) click New. Set the name to GIT_SSH and the value to C:\Program Files\Putty\plink.exe
- Click Ok a few times and close out of that junk
|
You need to make sure to set the right path of course if you installed PuTTY into another directory or unzipped it to another directory. Well, we about set it all up.
Now that we set it up we are ready to create us some identification. We will need this to log onto the repository server on
CodeBase and to gain Read/Write access on
SourceForge. To shorten this guide a bit I will only get into the details for CodeBase and point to the
SourceForge Wiki on SSH keys. Actually, I created my SF SSH key more than 2 years ago and I really got no clue what I did back then. *lol* Anyway, to make the key(s) for CodeBase do the following:
- Open PuTTYgen
- Hit the Generate Button
- Move the mouse randomly over the blank at the top as suggested by PuTTYgen
- (optional) For better security enter a keyphrase when the key pair was created
- Save public and private key to a safe location and make sure you don't loose them
- Right click on the text just below "Public key for pasting into OpenSSH autorized_keys file:", select "Select all", right click again on the text and select copy
- Go to your CodeBase account and click on "My Settings" at the very top of the page
- On the right side about in the middle of the page you will find "Your SSH Public Key(s)" where you select "Add New SSH Public Key" at the bottom of this block
- Enter a description and paste your clipboard (the public key we copied earlier) in the lower box
- Hit the "Save Key" button
Great, CodeBase knows about our public key.
The next step to be done is ensure that whenever PuTTY is consulted for our key it will accept the remote server. This is the same for both
CodeBase and
SourceForge.net so I will write just one list for both and make it clear in the right list item. Okay, let's do it:
- Open PuTTY (putty.exe) from your PuTTY install directory
- Enter "gitbase.com" for CodeBase or "PROJECTNAME.git.sourceforge.net" for SourceForge (PROJECTNAME being the unix name of the project you want to use Git with) in the "Host Name" box
- Hit the "Open" button
- Don't bother logging in, what you really need to do is confirm the servers fingerprint
This wasn't too tricky but still. I have not tried this yet but I highly suspect that you will have to do this major step for any SourceForge project you want to use Git with. This step might be redundant if you used TortoisePlink.exe but I do not know if that would work with msysgit so just stick with this.
In order to set a username and an email address for ourselves we do some really minor command line action. Open up GitBash from the start menu. All you need to do is enter the following and your name and mail address is set globally. I think you can also set it for each repository differently after setting it globally but... well... not so important for me right here.
Alternatively, you can set these options in the "Options" page of GitGUI but that would require you to create/open/clone a repository first so you can access this. Anyhow, here you go with the command line commands as found in the
Git Guide on Sourcemage:
Zitat:
$ git config --global user.name "FirstName LastName"
$ git config --global user.email "user@example.com"
|
The following part can actually be a bit of a pain in the butt. Whenever you want to use Git you will have to do the following but once done it will last for all of the session and rebooting sucks anyway, right?
- Open Pageant (pageant.exe) from the PuTTY package
- Right click the Pageant tray icon and click on "Add Key"
- Browse to the key you would like to add (e.g. the key for CodeBase)
- Repeat this step for all keys you would like to add as well
Another way of doing this automatically is the following. However, be sure to create your keys without password or you will have to reenter your passwords on any reboot. Also
note that this bears some
security risks. My source for this are the
PuTTY Docs. This is how you do it:
- Go to the start menu, right click the "PuTTY" item in All Programs and click on "Explore"
- Do the same for "Startup"
- Copy "Pageant" from "PuTTY" to "Startup"
- Right click that shortcut and click on Properties
- Add the complete path to the private key(s) (*.ppk) behind "[...]\pageant.exe" (seperate by space) e.g. <<"C:/PuTTY/pageant.exe" D:\Documents\MyPrivateKey.ppk>>
- Apply
We are finally ready for using Git! HOORAY!
Okay, there are some quirks I noticed when using TortoiseGit-0.5.1.0 so far. First of all, the add and commit command screw up on large numbers of files. You may want to use msysgit's Git Bash for this. I won't go into the details on how to do this here, though. When you initialize a repository on CodeBase you will find a guide on how to do it with Git Bash (or any other command line Git tool) and for SourceForge see
their Wiki on Git.
Another ressource I found fairly useful was the
Git Guide on Sourcemage. Probably the most important address of all is
the official Git homepage.
That's it for me now. If you got any trouble feel free to ask me here or anywhere else. If you find any failure in spelling or content in this guide please tell me all about it. I want to thank Drew Blas for his Guide on Git. Although I have not been using Git for more than a few hours, yet, but I think it really is a powerful tool and you should all try it if you dare.
Regards, Stulle