HedgeBlog

Integrate your iPhone/iPad iOS project GIT with TFS – Step by Step

As many of you know Hedgehog is predominantly a Microsoft shop, so we love TFS. I’ve worked with it for years, and think it is the best Source Control on the market. However, when I crossed into the Apple ecosystem to write an iOS app, it was a bit inconvenient to be forced to use GIT. xCode does not [yet] have a source code plugin mechanism like Visual Studio does, so we are stuck with what Apple gives us – GIT. GIT is great – but I miss my TFS! Lucky, Microsoft released a cross-platform Java plugin that bridges the gap between GIT and TFS – GIT-TF.

While you could use GIT-TF with ANY GIT repository (OSX, Windows, etc.), this post will focus on integrating an xCode 4 out-of-the-box GIT repository and your TFS instance.

This post will show you how to:

  • Check-in your existing xCode project code into TFS
  • Pull down the code from TFS (presumably) onto another developer’s Mac.

This post will NOT show you how to:

  • Set up TFS
  • Code in Objective C
  • Turn on your Mac =)

Check-in your existing xCode project code into TFS

 

  1. On your Mac, download and extract Git-TF. I placed it in /users/{myuseraccount}/git-tf
  2. Open Terminal and run the following commands this will establish path variables:
    1. export JAVA_HOME=/Library/Java/Home
    2. export PATH=$PATH:$JAVA_HOME/bin:/git_t
    3. export PATH=”/Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/”:$PATH
    4. export PATH=”/Users/{myuseraccount}//Git-Tf/”:$PATH
  3. change the working directory to your xCode project folder: e.g.:
    cd “/users/{myuseraccount}/documents/xCode Projects/testproject1/”
  4. If you show all hidden folders & files, you will see the hidden .git folder – this is your projects GIT repository folder. If this folder doesn’t exist, you don’t have GIT setup with your project – read this post to find out how to create one.
  5. Run Commands:
    • git tf configure https://yourtfswebaddress.com/tfs/gittfs $/testproject1/trunk/ios (if you get yelled at here about not having an empty folder, just append a new folder to $/testproject1/trunk/ios/mynewfolder)
    • git tf checkin
  6. If you get prompted to install Java in step 5 – do it. Then re-run the command.
      Now if(when) you get a java security exception, you will have to install your TFS SSL certificate and register it with JAVA so GIT-TF can talk to your TFS. You will only have to do this once.

      1. Download this InstallCert.jar: I put it inside the Git-TF folder – but it could go anywhere.
      2. In terminal, CD to the folder where you downloaded the .jar file. Then run the command:
        java -jar InstallCert.jar  https://yourtfswebaddress.com/tfs/gittfs
      3. This will create a file “jssecacerts”. Put this file in /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib (your java version may vary)
      4. Rerun the commands in step 5.
      5. Your code should now be in TFS

How to pull it down the code from TFS

 

Steps are nearly the same as above, after installing Git-TF and establishing the path variables, CD to your project directory, and run the command: git tf clone https://yourtfswebaddress.com/tfs/gittfs

That’s it! Hopefully this took the pain out of the GIT-TFS integration. I will leave it up to you to establish best practices on your team. Please feel free to ask me questions on twitter: @SteveStriga or in the comments below.

 

References:

 

0

Leave a Comment

HedgeBlog is the blog of Hedgehog, a full-service digital agency. It's our fresh take on what's new, what's now, what's next in technology, online media, and beyond. Drop by, chime in, and be inspired.

Newsletter

  • This field is for validation purposes and should be left unchanged.