Software

How to access GitHub, Bitbucket, and other git repositories on iOS

Developers often use git repositories to store and retrieve source code files. This is usually done on a desktop computer, but new iOS apps allow you to access git repositories while on the go.

githero.jpg
Cory Bohon / TechRepublic

Git is the modern standard for source code hosting. Large hosting platforms like GitHub and Atlassian's Bitbucket allow for easy creation of git repositories for storing apps and web source code for sharing amongst teams during the development process. But, what if you want to access the repositories, perform merges, and commit code while you're on iOS?

Fortunately, there are quite a few good apps that you can use on the iPhone and iPad to do this, and we'll take a look at one of the best: Working Copy.

SEE: Apple releases iOS 10.3.1 for iPhone, iPad (ZDNet)

Download Working Copy

I like Working Copy because it's a universal app that works on iPhone and iPad; it includes a built-in editor that lets you edit code; and it can handle many simple git tasks such as forking, merging, and reverting changes.

Working Copy is a paid app available on the App Store. It costs $14.99 USD to download.

Sign in with your git account or import keys

If you use GitHub, Bitbucket, GitLab, or GitBook, you can sign into your account to view available repositories. To do this inside of Working Copy, follow these steps.

  1. Open Working Copy.
  2. Tap Settings in the top left-hand corner and then tap Hosting Providers.
  3. Select your provider (Figure A).
  4. Enter your username and password

Figure A

gitfigurea.jpg

Select your hosting provider to get instructions on how to sign in or set up your server settings inside Working Copy.

Cory Bohon / TechRepublic

Now that you've signed in to your git hosting account, you'll need to either generate a new SSH key for your device or import an existing key. Follow the directions below for each of those tasks.

How to generate a new SSH key

  1. Open Working Copy.
  2. Select Settings | SSH Keys | + Button (Figure B).
  3. Select Generate Key.

Figure B

gitfigureb.jpg

Working Copy gives you three options for getting SSH keys on your iOS device for interfacing with the git hosting server of your choice.

Cory Bohon / TechRepublic

You'll be presented with a new SSH key that you can name to your liking. You can export the public or private keys via email, iMessage, or AirDrop so you can import those keys with your git hosting provider.

How to import an existing SSH key

  1. Open Working Copy.
  2. Select Settings | SSH Keys | + Button.
  3. Select either Import File (if the SSH key to import is stored in iCloud Drive or another location on your device) or Import From Clipboard (if you copied your SSH key to your iOS clipboard).

If you don't wish to add an SSH key and use HTTP or HTTPS clones instead, you can skip this step. When cloning the repository you'll be prompted to enter the username and password if cloning via HTTP/S.

How to clone repositories

To clone a repository to your local device, open Working Copy and navigate back to the app's main screen. Tap the + button to bring up the Clone Repository view (Figure C).

Figure C

gitfigurec.jpg

Enter your repository clone URL to begin the cloning process.

Cory Bohon / TechRepublic

To clone a new repository on the device, follow these steps.

  1. Enter the URL (HTTP, HTTPS, and SSH URLs are supported).
  2. Select Clone.

While in this view, you can also see all repositories available to clone from your signed in hosting account, such as Bitbucket and GitHub, from the list below the clone URL text entry.

If the SSH key created in the Working Copy app has already been associated with your git hosting service, the clone will start immediately. If you're using an HTTP/S clone, you'll be prompted to provide your username and password before continuing.

After tapping the Clone button, the repository will be cloned from the remote URL and added to Working Copy where you can edit the files inside of the app by tapping a file name. Once edited, the changes will appear and can be committed and pushed back to the remote repository.

Also see

About Cory Bohon

Cory Bohon is an indie developer specializing in iOS and OS X development. He runs a software company called Cocoa App and is also a developer at MartianCraft. He was introduced to technology at an early age and has been writing about his favorite te...

Editor's Picks

Free Newsletters, In your Inbox