This course page was updated until March 2022 when I left Durham University. For future updates, please visit the new version of the course pages.
Remote development and managing changes #
Remote editing #
Editing in a terminal is somewhat painful, and laboriously copying files back and forth between your local machine and Hamilton is error-prone.
A better approach is to use a combination of version control and remote editing. I provide brief instructions for VS Code which is a popular editor, and very brief instructions for Emacs.
VS Code #
VS Code has an extension for remote editing which allows you to edit files on remote systems as if you’re running locally.
Search the extensions marketplace and install the Remote
Development
extension pack. You can then connect to a remote SSH server (of which
Hamilton is an example). If you followed the instructions to setup simpler ssh logins, then just hit
F1
(to pop up the “command palette”) and run the “Remote-SSH: Connect
to Host” command.
You can then use VS code, browsing the Hamilton filesystem as if it were local.
The way remote editing in VS code works results in it creating a directory
~/.vscode-server
in your home directory on Hamilton.You might run in to quota issues (check if the “Soft limit” for files in the output of the
quota
command is hit).To work around this, we can move the vscode directory somewhere else and then symlink it back.
You can run this sequence of commands at the terminal to achieve this, you’ll only need to do it once.
$ mv $HOME/.vscode-server /ddn/data/$USER/vscode-server $ ln -s /ddn/data/$USER/vscode-server $HOME/.vscode-server
I don’t use VS Code myself, so can’t help with further configuration or editing, but hopefully this is useful.
Emacs #
If you use Emacs, then TRAMP offers similar functionality, you can browse the remote filesystem and edit as normal.
If you want to use magit, the version of git
available on Hamilton is unfortunately too old. You might be able to
compile your own version and put it in your PATH
, you’ll then need
to add (add-to-list 'tramp-remote-path 'tramp-own-remote-path)
to
your .emacs
.
Managing changes with version control #
All of the material for the course is maintained in a git repository on GitHub. This makes it easy for me to keep things up to date. If you have followed the advice to clone a copy of the repository then you probably want to know how to
- Keep getting updates that I create
- Make sure your changes are saved
- Move your changes between computers (for example off Hamilton)
To do this, I recommend the following workflow. You will need a GitHub account, so if you don’t have one, go away and register.
The free tier of GitHub disables some useful features. Fortunately, as a student, you can sign up to an educational license which upgrades your account for free. After creating your github account, sign up for the student developer pack. Your Durham email will need to be associated with your account, follow instructions here if it isn’t already.
With your new account available, “fork” the course repository. This creates a copy associated with your account which you have edit access in.
Now you can edit and commit away in the repository and push and pull any changes to your fork.
To synchronise with my version, you can either do it on the commandline, or in the GitHub web interface with pull requests. The Earth Lab have a nice tutorial for the latter approach.