[eMule-Web]

[eMule-Web] (http://www.emule-web.de/board/)
-   Hard- und Software Allgemein (http://www.emule-web.de/board/hard-und-software-allgemein/)
-   -   Git Revision Control Software Guide (http://www.emule-web.de/board/14022-git-revision-control-software-guide.html)

Stulle 13. April 2009 12:22

Git Revision Control Software Guide
 
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:

  1. In Windows (XP) Press WindowsKey + Pause/Break or double-click System in the Control Panel
  2. Under the Advanced tab click Environment Variables
  3. Under user variables (the top set) click New. Set the name to GIT_SSH and the value to C:\Program Files\Putty\plink.exe
  4. 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:
  1. Open PuTTYgen
  2. Hit the Generate Button
  3. Move the mouse randomly over the blank at the top as suggested by PuTTYgen
  4. (optional) For better security enter a keyphrase when the key pair was created
  5. Save public and private key to a safe location and make sure you don't loose them
  6. 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
  7. Go to your CodeBase account and click on "My Settings" at the very top of the page
  8. 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
  9. Enter a description and paste your clipboard (the public key we copied earlier) in the lower box
  10. 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:
  1. Open PuTTY (putty.exe) from your PuTTY install directory
  2. 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
  3. Hit the "Open" button
  4. 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? ;)
  1. Open Pageant (pageant.exe) from the PuTTY package
  2. Right click the Pageant tray icon and click on "Add Key"
  3. Browse to the key you would like to add (e.g. the key for CodeBase)
  4. 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:
  1. Go to the start menu, right click the "PuTTY" item in All Programs and click on "Explore"
  2. Do the same for "Startup"
  3. Copy "Pageant" from "PuTTY" to "Startup"
  4. Right click that shortcut and click on Properties
  5. 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>>
  6. 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

Stulle 19. April 2009 14:49

I will reserve this post so I can continue the guide without running into the board limit... at a later time if I feel like it.

Stulle 19. April 2009 14:59

I added another paragraph on setting the name and email to the config and I reworked some of the install part. All this is integrated into the first post already. :)

Stulle 19. April 2009 19:04

Appended the Pageant paragraph by an automized way.


Alle Zeitangaben in WEZ +1. Es ist jetzt 06:27 Uhr.

Powered by vBulletin® Version 3.8.3 (Deutsch)
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102