Skip to content

Tutorial

Achilleas Koutsou edited this page Mar 20, 2017 · 13 revisions

Prerequisites

Using the gin command line client requires an active gin account. You can register by visiting the GIN website.

Basic usage

Basic usage help is included in the command line and can be printed using:

gin --help

Extended descriptions of all commands can be printed using:

gin cmdhelp

Quickstart tutorial

This is a quickstart tutorial. It explains a common workflow that one might go through when using the client. For more detailed descriptions of what each command is doing, read the next section.

Assuming you have registered with the GIN services, you can login from the command line using:

gin login

The command will prompt you for a username and password. If entered correctly, you will be greeted with a confirmation message.

Create a repository

Before uploading any files, you must first create a repository on the server. You can do this using the gin create command.

gin create tutorial

In this example, tutorial is the name of the repository. Repository names must be unique for a user (i.e., a single user cannot have two repositories with the same name) and the full name of a repository is the name of the user who created it, along with the repository name, separated by a /. For example, if user user has a repository called tutorial, the full repository name is user/tutorial.

List repositories on the server

You can see a list of the repositories that you own using:

gin repos user

Omitting the username for this command lists all public repositories. Additionally, you can use the same command to see a list of repositories owned by any given user that are accessible by you.

For instance

gin repos alice

will list all repositories owned by the user alice that you can download. This includes public repositories owned by Alice as well as repositories that Alice has chosen to share with you.

Get gin repository from the server

Once the repository is created on the server, it's time to download the (empty) new repository and initialise the local directory that we will use to upload and download data. As mentioned above, for the tutorial we are assuming the username is user and the repository name is tutorial. The gin get command requires us to specify the full name of the repository.

gin get user/tutorial

This will create a directory called tutorial under the directory that you are working in. Note that the command will fail with an error if a directory called tutorial already exists.

Following this, all upload and download commands should be entered from within the repository's directory.

cd tutorial

Add files to the local directory

Copy some data files, or source code into the tutorial directory using any regular method for copying files.

Upload new files to the server

To upload the files that are now inside the tutorial directory, simply issue the upload command.

gin upload

This will commit your changes, in other words, it will detect the new files in the directory, add them to the repository, and start uploading to the GIN server.

Every time you perform a gin upload the changes are saved and uploaded and a checkpoint is made of your data.

Note that upload here doesn't only mean sending new files and changes to the server. This command sends all changes made in the directory to the server, including deletions, renames, etc. Therefore, if you delete files from the directory on your computer and perform a gin upload, the deletion will also be uploaded, so to speak, and the file will be removed from the server as well.

Fetch any repository updates from the server

If changes are made to your data elsewhere, for example on another computer, or from another user that you share your data with, you can download these changes by typing the download command from within the repository.

gin download

Advanced tutorial

A more advanced tutorial with explanation of the internals of the client is being prepared and will be available soon.

Clone this wiki locally