# Accessing My Home Git Service with an SSH Config

When building a robust NAS solution at home, the first thing I wanted to do is to be able to access it from outside my home network.  I have chosen to use [noip] to provide dynamic DNS access, which works wonderfully for apps like [Plex].  However, when I am at work, I am not able to reap the benefits of a dynamic IP service.  I have resorted to using my [ssh-config] to provide home access while I am work, and I have been happy surprised at the benefits of using a [ssh-config].  For the rest of this post, I would like to demonstrate how I access my home git service.

Without getting too much into the weeds, allow me to explain my home network.  It it quite simple.  I have one [FreeNAS] server that has several jails configured.  One of the jails provide git services using [gitolite] which allows robust management of keys and permissions to git repositories.

I only have one IP, and it is a dynamically assigned IP.  It does not change very often, so I am using that to my advantage.  My home router is an [Apple Airport Extreme], which is able to do port mapping.  On my local network, my git repositories are served from `10.0.1.201`. It is using the standard ssh port of `22`.  I have configured my [Apple Airport Extreme] to map an external port of `2022` to my local port of `10.0.1.201:22`.

On my laptop, I have the following [ssh-config] file.  The configuration should be located at `~/.ssh/config`. The IP is fake, FWIW.

```
Host git-remote
  HostName 97.97.97.97
  Port 2022
  User git

Host git-home
  HostName 10.0.1.201
  User git
```

This configuration shows that when I am at home, I can use my `git-home` host, and when I am remote, I can use my `git-remote` host.  Where did those names come from?  The neat this is that I made them up.  At this point, if I am at work, and I wanted to clone this website's git repo, I would use the following command.

```sh
git clone git@git-remote:greghewett.com.git
```

`git-remote` does not resolve outside of the use of ssh, so I would not be able to use it in my web browser.  When the IP changes, it is not very hard to go to [noip] and figure out what the IP has changed to and update my [ssh-config].

Recently, I discovered that [Transmit] will also use the [ssh-config], which allows me to change the IP address in one place to affect not only my git repositories, but also my [Transmit] server configurations.  Below, you can see the access to my home developer service, which is just a [FreeNAS] jail that has all of the developer bells and whistles installed.

![Transmit Screenshot](2017-02-07-accessing-my-home-git-service/transmit_screenshot.png)


[FreeNAS]: http://www.freenas.org/
[ssh-config]: http://man.openbsd.org/sshd_config
[Plex]: https://www.plex.tv
[Transmit]: https://panic.com/transmit/
[noip]: https://www.noip.com
[gitolite]: http://gitolite.com/gitolite/index.html
[Apple Airport Extreme]: http://www.apple.com/airport-extreme/
