Community/Knowledge Base

Accessing your projects with git

James
posted this on January 29, 2011 19:40

Did you know you can access your ScribTeX projects via the git version control system? Git is a powerful program which helps to keep two or more copies of a project up to date with each other. With ScribTeX it will make it easy to keep a local copy of your project synchronized with your online files. Git takes care of tracking changes and merging any differences that arise between the copies. Unfortunately git has quite a steep learning curve. If you are new to it and looking to learn more, the Git Community Book is a great place to start.

To access your project's git repository you must have an SSH key pair set up. This is a secure way of authenticating your computer with the ScribTeX server. If you aren't familiar with SSH keys, the documentation at GitHub provides an excellent guide for setting them up. Most of the guide will apply equally well to ScribTeX and the GitHub specific steps can easily be adapted.

Once you have your SSH keys configured you need to upload your public key to ScribTeX. This can be done through your preferences:

Screenshot-Edit_your_account___ScribTeX_-_Mozilla_Firefox.png

Click on 'Edit Preferences' in the Account details section of your dashboard. From here, click on 'SSH Keys' and you will be prompted to upload your public key. You should give the key a descriptive name such as the computer it corresponds to.

You will now be able to access your projects via git. To find the url for a project, go to its settings page and click on 'Git Access':

Screenshot-ScribTeX_Demo_settings___ScribTeX_-_Mozilla_Firefox.png

You can use git to checkout and maintain your projects offline:

$ git clone git@git.scribtex.com/bob/my-project.git

Make some local changes, commit them to git, and push them back to ScribTeX:

$ git commit -a -m 'Updated my files on my own computer'
$ git push origin master

Enjoy!

Please note that ScribTeX is not a full git hosting solution and has a few restrictions. ScribTeX is very fussy about preserving its history and so you will not be able to rebase or change any commits that already exist on the ScribTeX server. Hopefully this restriction will eventually be lifted, but for now it keeps things sane on the ScribTeX server. You should also note that only the master branch is available for editing via the ScribTeX web interface.

 

Comments

User photo
Juanlu001

And what is the RSA key fingerprint?

May 16, 2011 21:30
User photo
nxg

In the example 'git clone' command, the repository spec should be ....com:/bob... -- that is, a colon instead of a slash.

December 20, 2011 16:24
User photo
sirjofri

I have problems with adding ssh-keys. it doesn't save the user@host-part

February 24, 2013 17:09