Git

From Ontohub
Revision as of 10:21, 24 February 2014 by Tillmo (talk | contribs) (Access with permissions: better explanation)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Git is a decentralised version control system. Ontohub uses Git for maintaining repositories of ontologies.

Access to a Git repository

Access for anyone

On the main page of a repository, you find a "clone with Git" URL for cloning the repository. At the command line, with

 git clone <URL>

you can create a local copy of the repository on your computer. (If you have a graphical interface for Git, enter the URL at the appropriate place for cloning). Note that you will have only limited access to the repository, depending on its access type (for private repositories, you won't have any access, for public readable repositories, you will have read access, for public readbale and writable repositories, you also will have write access).

Access with permissions

If you want to have also write access, then you have to uploaded an SSH key, and use the "clone with git-ssh" URL for cloning. Then you will have access as specified by your permissions: e.g. you get write access to an otherwise read-only repository, or you get read access to an otherwise private repository. You will also get write access to all public writable repositories - you won't need any permissions for that, but you still need to upload your ssh key (this is needed for protection against Spam).

Working with a Git repository

The usual working cycle is:

  • make some local changes
  • add the new and changed files using "git add <files>". With "git add .", you add everything.
  • if needed, remove files using "git rm <files>".
  • commit your changes using "git commit" or "git commit -m <message>"
  • push your changes to the ontohub server with "git push"
  • if someone else has pushed in the meantime, you have to get his/her commits first, using "git pull". This will merge both commits. Note that nothing can get lost, you can always restore your commit if needed.

Pushing to an empty repository

In this case, you need to use "git push origin master"

Read more

Documentation of Git and a try-out tour can be found at [1].