Posts Tagged ‘code repository’

By Mike Hubbartt, © Copyright 2011, All Rights Reserved.

In the old days, developers used file system directories with customer naming conventions to organize their code and support files. This was a problem if the files were stored locally and the computer hard drive failed, and it made it difficult to keep code in sync when other developers had local versions of code that may have changes that impacted other areas of a program. Some companies used file servers to store source code, but again it could be difficult to keep source code synced if developers made local changes and forgot to update the main code on the file server.

The solution? Code repositories. Repositories are programs that store and organize source code, executable code, images, attachments, and libraries for client and server-based applications. Many companies also prefer to store project documentation like requirements, specifications, user guides, and project plans in their repositories. With repositories, materials are checked in and out as needed, and older historical versions of the materials are available for rollback (or comparison) in the event that code changes introduce a bug in the program.

Since many company applications are developed and maintained by more than one developer, repositories enable developers to access the entire application while working on their individual coding tasks. Each developer checks out part or all of the code, modifies existing or creates new code for their assigned tasks, tests their code, and then checks the code back into the repository. The changes are tracked, so it is easy to see who made what changes at any point of the project.

This post covers the procedure to setup a remote Git (a Distributed Version Control System) and a remote SVN (a Centralized Version Control System) repository. Please refer to our posts Configure Mac IDEs to Access a Remote Subversion Repository (June 15, 2011) and Configure Mac IDEs to Access a Remote Git Repository (June 24, 2011) for the steps to configure IDEs to access repositories like the two covered in this procedure.

ProjectLocker

I like ProjectLocker because Git is a popular repository in the business world and I’ve seen a number of companies move towards it the past year. ProjectLocker has one free plan where one to three people can share a SVN or Git repository, whereas Freepository also has a free plan but only one person can access the SVN repository – teams are required to pay a monthly fee to share the repository. ProjectLocker also offers five commercial plans where groups of 15 – 250 users can have SVN or Git repositories. I encourage students that want to learn about code repositories to check out this repository hosting site.

To get setup with a repository at ProjectLocker,  go to their website (http://www.projectlocker.com), register, setup a project, and then you are ready to configure your IDE so it can access your repository. Its pretty simple and straight-forward, so I won’t go into the setup at this time.

Something nice about ProjectLocker: refer friends and gain extra resources. For each friend that you recommend and they join ProjectLocker, you gain 50 MB of disk storage space. When 5 friends you recommend join ProjectLocker, you gain another user for your account.

Setup a ProjectLocker Account
  1. Go to the website (http://www.projectLocker.com), select the Account Type (the first one is free).
  2. Now enter an Account Name and Initial Project Name. Select the Initial Project Type (Git in this case), then enter your email address and a password to access your repository. Press the ‘Continue’ button to continue setup.
  3. Provide personal information as requested.
  4. You should receive a Account Created confirmation.
  5. Log into the ProjectLocker portal.
  6. The first time you log in, you will be prompted for a security question and a security answer. Enter both, then press the ‘Save Security Information’ button to continue.
  7. You now see the main portal screen.
  8. Stepping away from the Portal Page of ProjectLocker, you need a public key to communicate with Git via SSH. Open a Terminal Window and enter ‘ssh-keygen’. You are asked for a file name/location for the file (both a public and private key are generated).
  9. Back at the Portal Page, Select ‘Manage Public Keys’ underneath ‘User Links’ at the far left side of the page.
  10. Since no keys have been added, select ‘New Key’.
  11. Enter the Name, User name, and public key, then press the ‘Save Public Key’ button.
  12. A ‘Public Key <Name> Saved Successfully’ tells you the process was done correctly. Now select ‘User Home’ under ‘User Links’ at the far left side of the screen to return to your main portal page.

Codesion

Codesion, like ProjectLocker offers SVN and Git repositories for free and for a monthly charge.Check out their website for pricing information.

  1. To get started, go to the Codesion website and begin the sign up process.
  2. Enter your information. Your domain, login, and password entered at this time are used to log into your account, so keep track of them. Your email address is where you receive confirmation about the repository setup.
  3. Enter all the information with an asterisk beside the field label and select the ‘Create My Codesion Account’ button.
  4. Codesion emails confirmation the account is setup – check the email you specified in step 2 of this procedure.
  5. Login to your account. Enter your domain, login, and password, and then press the ‘Login’ button.
  6. Enter your industry information from the three drop down lists on the bottom of this page.
  7. Now enter a new project name and press the ‘Next’ button.
  8. Select Git or Subversion as the repository for your new project. For this example, select ‘Subversion’ and press the ‘Next’ button.
  9. Now select ‘Blank repository’ or ‘Best Practice’. For this example select ‘Best Practice’ and press the ‘Next’ button.
  10. You project is now setup. The screen now shows the project URL you need to access the repository from your IDE.
  11. Now that the project is created, you can view the website project tab in your browser.

Pretty simple process to setup a new remote SVN repository.

By Mike Hubbartt, © Copyright 2011, All Rights Reserved.

Code repositories are server-based applications to store common code. Our post Configure Mac IDEs to Access a Remote Subversion Repository (June 15, 2011) provides instructions on connecting an IDE to a remote SVN repository (Centralized Version Control System), while our post Configure Mac IDEs to Access a Remote Git Repository (June 24, 2011) provides instructions on connecting an IDE to a remote Git repository (Distributed Version Control System). This procedure covers configuring IDEs for remote repositories once they are setup or they are made available to you.

Configuring Git for Eclipse Galileo

  1. Launch Eclipse.
  2. Select ‘Help/Install New Software’ from the IDE menu.
  3. You are at the Install Screen. Enter (without the surrounding quotes) ‘EGit – http://download.eclipse.org/egit/updates-1.0&#8217; in the field beside ‘Work With:’, then press the ‘Add Site’ button.
  4. Expand the top section (Eclipse Git Team Provider) and select ‘Eclipse EGit’. Press the ‘Next’ button.
  5. Review the items to be installed and then press the ‘Next’ button.
  6. Select ‘I accept the terms of the license agreements’ (if you want to), then press the ‘Finish’ button to install the plug-in.
  7. After the plug-in is installed, restart Eclipse. At the top of the workbench, select the ‘Open Perspective’ button, then select ‘Git Repository Exploring’.
  8. This is the Eclipse Git perspective.

Configuring Git for Xcode 4

Configuring Git for Xcode is a bit more involved than it was to configure this IDE for Subversion. There are two extra processes involved: downloading and installing Git, and creating a symlink to the Git command line tool.

IMPORTANT NOTE. I heard that Git might already be installed as a part of Mac OSX but did not find it on my copy of OSX 10.6.7 (Snow Leopard). If anyone knows that it is pre-installed, please drop me a line to the directory location and I will update this procedure.

Lets get started, assuming we need to download and install Git.

  1. If Git is already installed, skip to step 6, otherwise proceed to step 2.
  2. Download Git. I went to this site and downloaded git-1.7.5.4-i386-leopard.dmg.
  3. Double click on the dmg file to install Git. My copy installed in /usr/local/git/bin.
  4. Open a Terminal, then enter cd .. two times to move to the root (/) directory, then enter cd /usr.
  5. Create the symlink to the Git command line tool: Enter the following command (assuming your copy of Git installs in the same directory as mine – see step 2 of this procedure):
     sudo ln -s /usr/local/git/bin/git /usr/bin/git
  6. Launch Xcode.
  7. Select ‘Window/Organizer’ to bring the Organizer to the screen, then select the Repositories section at the top of this screen.
  8. Select the ‘+’ at the bottom left of the Organizer screen, then select ‘Add New Repository’. At this point, select ‘Type’ and Git is now included in the list (along with Subversion) of supported repositories.  Enter a relevant name and the URL to the hosting site (ProjectLocker in this case, but others can be added for work and school sites as needed).

By Mike Hubbartt, © Copyright 2011, All Rights Reserved.

There are commercial repositories and open source repositories. The commercial repositories charge, usually based on the number of people accessing the repository. Open source repositories can be installed on internal company servers or there are companies that host open source repositories for no or little cost (also typically rated by the number of repository users). I’ve used Subversion (SVN), a centralized version control system, for company and class projects, so this article covers the the hosted version of SVN on Freepository with the Eclipse, Xcode 4, and Intellij IDEA 10 CE IDEs.

Freepository

Freepository has one free plan, where individuals can have a SVN repository for personal use at no cost. They also offer two commercial plans where groups can have SVN or Git repositories. I have found other sites that have good repositories with the same type of arrangements (free and billable setups), but I like how easy it is to setup and use SVN at Freepository and would encourage students that want to learn about code repositories to check them out.

To get setup with Freepository, go to their website (https://freepository.com/index.php), register, and you are ready to configure your IDE so it can access your repository. Its pretty simple and straight-forward, so I won’t go into the setup at this time. There are a lot of IDEs, so I’m focusing on Eclipse and Xcode for this article.

Configure Eclipse Galileo for SVN

These are the steps to configure Eclipse to use Freepository (or any other SVN repository):

  1. Launch Eclipse, then select ‘Check for Updates’. Some may be available since the last time your copy of the software was built, so get the updates before installing add-ons. Restart Eclipse if any updates were done.
  2. Select ‘Help/Install New Software’ from the Eclipse menu.
  3. At the Install screen, beside ‘Work With’, select ‘Galileo – http://download.eclipse.org/releases/galileo&#8217;.
  4. Scroll down to ‘Collaboration’ and expand that section.
  5. Select ‘Subversion SVN Team Provider (Incubation)’, then press the ‘Next’ button at the bottom of the Install screen.
  6. Verify this is the correct file and press the ‘Finish’ button at the bottom of the screen.
  7. After the add-in is installed, restart Eclipse.
  8. Now it is time to install the Subversion Connector. Select ‘SVNKit 1.3.0 Implementation (Optional), and restart Eclipse after the connector is installed.
  9. Now switch to the Eclipse ‘SVN Repository Exploring’ perspective.
  10. Select ‘New repository location’ at the top/left area of Eclipse.
  11. Enter the repository information (your company’s own or the one from the Freepository in the previous section of this document) in the field beside URL in ‘New Repository Location’ popup. You also need to enter your user name and password at this time to avoid being asked for it whenever you try to access Freepository. I also prefer to select ‘Save Password’ so it is not necessary to re-enter it each time I access the repository.
  12. Now select the ‘Finish’ button. After the repository is added, you can select it in the ‘SVN Repositories’ window (typically at the far left side of the Eclipse ‘SVN Repository Exploring perspective). Please note Eclipse supports multiple SVN repositories, and it is common to have multiple SVN sites for personal, work, and school projects.
  13. All in all SVN works well with Eclipse.

Configure Xcode 4 for SVN

Xcode 3 is shipped with most Macs and is available free to developers that join the Mac/iOS Developer Program, or for $4.99 from the Apple App store. Compared to Eclipse, Xcode 4 is very easy to setup for SVN.

  1. Launch Xcode 4.
  2. Select ‘Repositories’ at the top of the Xcode Organizer.
  3. Select the ‘+’ sign at the bottom left of the Xcode Organizer, then select ‘Add Repository’.
  4. Enter the name and location, then press the ‘Next’ button to finish setting up the repository.
  5. You can leave the Trunk, Branches, and Tags as is for Freepository, then press the ‘Add’ button to complete setup. Select ‘Repositories; at the top of the Xcode Organizer screen to see the new repository.

Not a lot to do to get yourself setup for using a code repository, which is something most new developers learn when starting their first job as a programmer.

Configure IntelliJ IDEA 10.5 CE for SVN

Probably the easiest of these three IDEs to configure to access a remote SVN repository. All you need to do is connect to the repository.

  1. Launch IDEA.
  2. Select ‘Version Control/Browse VCS Repository/Browse Subversion Repository’ from the IDE menu.
  3. To add a new SVN repository, select the ‘+’ beside ‘Repositories:’ at the top of this popup screen, or select the repository from the list in the popup to access an existing repository. To see the projects in each repository, expand the appropriate repository folder.