Difference between revisions of "Git"

From Ontohub
Jump to: navigation, search
(Access with permissions: better explanation)
 
(One intermediate revision by one other user not shown)
Line 9: Line 9:
  
 
===Access with permissions===
 
===Access with permissions===
If you have the [[permissions]] for the repository and have uploaded an [[SSH keys|SSH key]], you can also use the "clone with git-ssh" URL for cloning. Then you will have access as specified by the permissions (e.g. you could have write access, while with access for anyone, you only would get read access, or you could have read access, while with access for anyone, you would get no access at all).
+
If you want to have also write access, then you have to uploaded an [[SSH keys|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 repsoitory==
+
==Working with a Git repository==
 
The usual working cycle is:
 
The usual working cycle is:
 
* make some local changes
 
* make some local changes

Latest revision as of 10:21, 24 February 2014

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].