git is essentially decentralized, which seems to be the direction everything is going, so I decided to take a shot at it.
I’ve used cvs, VSS, TFS, SVN and now git and I’ve got to say it is definitely pretty cool (and free).
The main difference I have noticed between git and these other guys is git allows you to make commits to your local machine and push them later. This means faster commits, more commits and therefore more versioning and finer details on revisions, and no need to worry about potential connectivity issues.
Behind the scenes git is also much cleaner on everything from its transmission protocols to its storage mechanism, so overall it is a more evolved product.
I haven’t fully explored all of its features yet, so I’ll keep revisiting this article to keep it updated from time to time.
First of all, you will have to decide upon a remote repository. You could setup your own, but that is currently out of scope of this article. In this scenario I chose projectlocker.
I left all projectlocker settings as default and using ssh as the communication protocol. http(s) is available as well, but ssh rocks :).
If you’re on Windows, download and install Cygwin and make sure you select OpenSSH. Cygwin will give you a nice little linux shell for us to do our work from. If you were hoping for a GUI, try this route first, you might be surprised at the simplicity of the command line.
Open cygwin to create a public key to authenticate to the remote server. Enter ssh-keygen and press enter. Keep pressing enter on all prompts and skip the password.
cd to the ~/.ssh folder where it likely created your key enter cat id_rsa.pub. This will dump the contents of your public key file. Right click on the command prompt title bar of the window and select mark then grab your dumped file and paste in your remote repo service. Make sure the username has no spaces and matches your pc name and is also listed in the file dump.
Save changes in remote service then go back to cygwin. To test you did the above step correctly do “ssh -v [your git without specifying port of \reponame.git]“. It shouldn’t connect fully, but should give you enough status to verify it’s working. If it prompts for password then it was unable to verify public key which the -v output should indicate.
Once the above is good, identify yourself with:
git config –global user.name “yourname”
git config –global user.email “firstname.lastname@example.org”
Then download the remote repository (which may or may not be empty, that’s ok).
git clone [yourauthpart@yourdomainpart:yourreponame.git]
To add in a project I already had in my local, I did the above steps first within C:\git then copied my project folder in C:\git\projectname. cd into git then use this command to add any files within:
git add [filename or wildcard * for all]
git commit -m “my first commit!”
Then to push up to repo at any point simply use:
git push origin master
And that’s it!
(Optional: If you get an error on push origin or skipped clone then first do):
git remote add origin [yourauthpart@yourdomainpart:yourreponame.git]
git pull origin master
So to sum up the steps we have:
1) setup repo on remote service
2) install cygwin and openssh (skip this step on *nix)
3) ssh-keygen (enter on all prompts)
4) cat public key and enter in remote repo service
5) test key setup is correct using ssh
6) identify your user and email to git
7) clone the repo and begin adding, committing and pushing!
Rock and roll!
cforcoding.com (blog), http://www.cforcoding.com/2009/09/windows-git-tutorial-cygwin-ssh-and.html
git-svn crash course, http://git.or.cz/course/svn.html
bahrenbugs (blog), http://blog.bahrenburgs.com/2010/01/using-git-with-projectlocker-on-mac.html
If you’re a Mac Poweruser and not already familiar with macports, this is great package I would highly recommend, especially if you’re a bit of a *nix terminal junkie.
Download and installation is a breeze. Click on the link for the dmg relative to your distro and it’s smooth sailing.
Once it’s installed however, you may run into a bit of a problem if you’re behind a corporate firewall.
sudo port -v selfupdate [MacPorts] #21034: Warning: No index(es) found! Have you synced your source indexes?
This message is followed by what may seem to be gibberish, but is actually informative logging telling you that rsync is being blocked.
I found numerous blogs and articles with no resolution to this issue, including one of the references below. Never fear! The solution is simple, and even outlined in the macports site.
First, make sure you are a sudo or root user, or you won’t have access to change the files necessary. (I outlined this in this article on my site).
After install make sure you close and reopen any terminal windows you have running.
1) Navigate to /opt/local/etc/macports.
2) sudo vi sources.conf
3) arrow down to the bottom line, bottom left corner, press “i” for insert then “#” key on your keyboard.
4) arrow to the end of the link and press return key on the keyboard
5) enter alternative url for macports tarball (without the quotes) “http://www.macports.org/files/ports.tar.gz [default]”
6) hit esc key on keyboard, then shift+: (colon) and finally “wq” which should exit you from vi and save changes
Voila! That’s it. You should now be able to update successfully. Note down any other errors you may encounter and happy porting. 8)
macports install, http://www.macports.org/install.php
macports alternative tarball sync, https://trac.macports.org/wiki/howto/PortTreeTarball
macports configuration files guide, http://guide.macports.org/chunked/internals.configuration-files.html
macports general howto, https://trac.macports.org/wiki/howto
Old Nabble Post with some similar user issues, http://old.nabble.com/-MacPorts—21034%3A-Warning%3A-No-index(es)-found!-Have-you-synced-your-source-indexes–td25264855.html
What is revision control, a.k.a source control?
At it’s core, what this term really means is a way for you to track changes that you may make over time to a particular file.
Each time you change the file and save/commit the change, it is stored as a transaction so you can easily roll back any changes you made at a later date, or search through the history to see something that may have been previously deleted or functional before recent changes.
Business documents usually contain multiple revisions, and knowing if you have the latest copy of a document floating around can be a headache if it changes frequently and the only form of distribution in your organization is email.
Source control will allow you to store all changes from multiple people in a single location, with intact historical reference to each change that is made.
Some source control systems are very popular, such as Microsoft VSS, TFS, SVN and CVS, however, many alternatives exist. There even exists a wikipedia page dedicated to listing a comparative chart of many different types.
After using many of these varieties, I have come to the conclusion that TFS and SVN are roughly equivalent in terms of enterprise scalability and functionality, and also the best overall solutions for development teams IMO. (I may post the proof and comparisons at a later date, too much for this post).
Right out of the box, SVN may not seem like much. To achieve the same functionality you get in a complete TFS installation, alot of configuration and installation must be done, but the end result is much easier to use in an SVN environment.
My recommended setup for SVN on Windows is as follows:
Tortoise SVN, http://tortoisesvn.tigris.org/
Ankh SVN, http://ankhsvn.open.collab.net/
Subversion Edge (SVN CLI), http://www.collab.net/downloads/subversion/
SVN Notifier, http://svnnotifier.tigris.org/
Good .Net API Reference, http://svnexpert.svn.sourceforge.net
Tortoise is a good tool for browsing the SVN repository and keeping your local folders in sync. Ankh is a Visual Studio plugin which allows for easy syncing directly from your IDE which is a nice feature esp. if migrating from a MS source control variant. Collabnet Subversion Edge is a good lightweight CLI if you are curious on all of the options available in SVN, or need to script something out automated. SVN Notifier is a good little utility that runs as a service and notifies you when updates occur from other team members. It also serves to automatically keep your files in sync as they are updated.
Wikipedia, “Comparison of revision control software”, http://en.wikipedia.org/wiki/Comparison_of_revision_control_software
Wikipedia, “Revision Control”, http://en.wikipedia.org/wiki/Revision_control
Wikipedia, “Apache Subversion”, http://en.wikipedia.org/wiki/Apache_Subversion
Wikipedia, “Microsoft Visual Source Safe”, http://en.wikipedia.org/wiki/Microsoft_Visual_SourceSafe
Wikipedia,”Concurrent Versions System”, http://en.wikipedia.org/wiki/Concurrent_Versions_System
Wikipedia, “Team Foundation Server”, http://en.wikipedia.org/wiki/Team_Foundation_Server