Working with an Arvados git repository

This tutorial describes how to work with an Arvados-managed git repository. Working with an Arvados git repository is very similar to working with other public git repositories.

Note:

This tutorial assumes that you have access to the Arvados command line tools and have set the API token and confirmed a working environment. .

Note:

This tutorial assumes that you have a working Arvados repository. If you do not have a repository created, you can follow the instructions in the Adding a new repository page. We will use the $USER/tutorial repository created in that page as the example.

Cloning a git repository

Before you start using Git, you should do some basic configuration (you only need to do this the first time):

~$ git config --global user.name "Your Name"
~$ git config --global user.email $USER@example.com

On the Arvados Workbench, click on the dropdown menu icon in the upper right corner of the top navigation menu to access the user settings menu, and click on the menu item Repositories. In the Repositories page, you should see the $USER/tutorial repository listed in the name column. Next to name is the column URL. Copy the URL value associated with your repository. This should look like https://git.qr1hi.arvadosapi.com/$USER/tutorial.git. Alternatively, you can use git@git.qr1hi.arvadosapi.com:$USER/tutorial.git

Next, on the Arvados virtual machine, clone your Git repository:

~$ cd $HOME # (or wherever you want to install)
~$ git clone https://git.qr1hi.arvadosapi.com/$USER/tutorial.git
Cloning into 'tutorial'...

This will create a Git repository in the directory called tutorial in your home directory. Say yes when prompted to continue with connection.
Ignore any warning that you are cloning an empty repository.

Note: If you are prompted for username and password when you try to git clone using this command, you may first need to update your git configuration. Execute the following commands to update your git configuration.

~$ git config 'credential.https://git.qr1hi.arvadosapi.com/.username' none
~$ git config 'credential.https://git.qr1hi.arvadosapi.com/.helper' '!cred(){ cat >/dev/null; if [ "$1" = get ]; then echo password=$ARVADOS_API_TOKEN; fi; };cred'

Creating a git branch in an Arvados repository

Create a git branch named tutorial_branch in the tutorial Arvados git repository.

~$ cd tutorial
~/tutorial$ git checkout -b tutorial_branch

Adding scripts to an Arvados repository

A git repository is a good place to store the CWL workflows that you run on Arvados.

First, create a simple CWL CommandLineTool:

~/tutorials$ nano hello.cwl
#!/usr/bin/env cwl-runner
# Copyright (C) The Arvados Authors. All rights reserved.
#
# SPDX-License-Identifier: CC-BY-SA-3.0

cwlVersion: v1.0
class: CommandLineTool
inputs: []
outputs: []
arguments: ["echo", "hello world!"]

Next, add the file to the git repository. This tells git that the file should be included on the next commit.

~/tutorial$ git add hello.cwl

Next, commit your changes. All staged changes are recorded into the local git repository:

~/tutorial$ git commit -m "my first script"

Finally, upload your changes to the remote repository:

~/tutorial/crunch_scripts$ git push origin tutorial_branch

The same steps can be used to add any of your custom bash, R, or python scripts to an Arvados repository.


Previous: Adding a new Arvados git repository Next: Linking alternate login accounts

The content of this documentation is licensed under the Creative Commons Attribution-Share Alike 3.0 United States licence.
Code samples in this documentation are licensed under the Apache License, Version 2.0.