Skip to main content
All CollectionsWEkEO JupyterHubAbout the WEkEO JupyterHub
Synchronize files on the WEkEO JupyterHub using the GitHub Plugin
Synchronize files on the WEkEO JupyterHub using the GitHub Plugin

Do you need a solution for backing up your files hosted on the WEkEO JupyterHub? The JupyterHub GitHub Plugin is here to help you!

Alexandre avatar
Written by Alexandre
Updated over a week ago

Context


Ensuring seamless synchronization and backup of files is crucial for researchers, scientists, and data enthusiasts leveraging platforms like the WEkEO JupyterHub. With the integration of the JupyterHub GitHub Plugin, users gain a powerful solution to effortlessly synchronize their work on the JupyterHub environment with GitHub repositories. This seamless integration not only facilitates efficient collaboration but also provides a reliable backup mechanism, offering peace of mind in the face of potential data loss or system disruptions. Whether working on complex data analysis projects or collaborative research endeavors, the JupyterHub GitHub Plugin empowers users to maintain version control, enhance productivity, and safeguard their valuable work effectively.

⚠️ Please note, that the files which can be uploaded to GitHub are limited to 50 MB each. Therefore, we further recommend to store large files outside of the working folder (but be aware that they will not be backed up).

Tutorial


Step 1. Create a GitHub Account

Log in to the site and follow the steps to create an account or log in to an existing account: GitHub.

Step 2. Create a new repository for the WEkEO JupyterHub backup

  1. Access your repositories and create a new one

  2. Create a file inside the repository to check the synchronization later

Step 3. Log into the WEkEO JupyterHub

From the WEkEO home page, log in to your WEkEO account, then launch the WEkEO JupyterHub via its icon in the top right-hand corner.


Step 4. Create an ssh key for authenticating with GitHub

  1. Execute the following code in the terminal inside the WEkEO JupyterHub:

    ssh-keygen -t ed25519 -C "email@email.com"

    replace the email@email.com with the email address you used for setting up the github account

Step 5: Add the SSH key to you github account

  1. Copy the public key which is saved in your Jupyterhub files and enter it in the github page. You can execute the following code in the terminal inside the JupyterHub to see the key:

    nano /home/jovyan/.ssh/id_ed25519.pub

    where the path is the one in which your public key has been saved.

  2. Check if the ssh set up was successful. Execute the following code in the terminal inside the WEkEO JupyterHub:

    ssh -T git@github.com 

    You may see a warning like this:

    > The authenticity of host 'github.com (IP ADDRESS)' can't be established.> ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
    > Are you sure you want to continue connecting (yes/no)?

  3. Enter “yes”

  4. You should now see a message like this in the terminal

    Hi <username>! You've successfully authenticated, but GitHub does not provide shell access.

Step 6: Go to the Git Extension button and Clone the repository you set up in step 2

  1. On the WEkEO JupyterHub on the left, you'll find the Git extension with its button. Then click on Clone a Repository.

  2. Go to your Github repository on the GitHub site and copy the URL.

  3. Then paste it into WEkEO JupyterHub.

  4. Now the github repository appears in the JupyterHub working directory

Step 8. Enable the ssh key for the repository

💡WEkEO Pro Tip: you only should have to do this once for each repository

  1. In the terminal go to your repository

    cd wekeo_backup
  2. And type:

    git remote set-url origin git@github.com:<gitaccount>/wekeo_backup.git

    ​replace<gitaccount> with your actual gitHub account name

Step 9. Create a file in the WEkEOJupyterHub

  1. In your cloned github repository create, for example, a new notebook:

  2. Once the File is created you see that there are untracked changes in the git section:



Step 10. Sync the JupyterHub with GitHub

Method 1. Using the git extension graphical interface

  1. Track changes by clicking the + when you slide the mouse over the “untracked” section

  2. The changes will now appear in the section “Staged”

  3. Commit the changes by filling out the “Summary” and a description of the changes in the bottom of the menu

  4. Click on Commit

  5. Enter your name and email

    When the commit was successful, a confirmation will appear on the bottom of the page.

    Push the committed changes to your GitHub repository

  6. You can now see that your repository version inside the JupyterHub is one commit ahead of the version in GitHub. Push the commits to GitHub to synchronize both versions by clicking on the button ( )

  7. Because you set up the ssh connection this works now without your username and password​

Method 2. Using git in the command line

  1. Let's create another notebook called “test2_notebook.ipynb”

  2. In the terminal go to the wekeo_backup folger and type

    git status

    You will get the untracked files here

    On branch main
    Your branch is up to date with 'origin/main'.
    Untracked files:
    (use git add <file>... to include in what will be committed)
    .ipynb_checkpoints/test2_notebook-checkpoint.ipynb
    test2_notebook.ipynb
    nothing added to commit but untracked files present (use "git add" to track)

  3. Next we stage the changes using (stace all changes by adding the -A )

    git add -A
  4. Next, we commit the changes and add a commit message

    git commit -am "added additional notebook and push using command line"
  5. Next, we push it in the command line using

    git push

Step 11. Check if the push worked

We see that the notebooks are now available in our GitHub repository

That's it, you've successfully configured your GitHub with your WEkEO JupyterHub. You can now synchronize your files! 💪


What's next?


We are user-driven and we implement users' suggestions, so feel free to contact us:

  • through a chat session available in the bottom right corner of the page

  • via e-mail to our support team (supportATwekeo.eu)

Did this answer your question?