Skip to content

Instantly share code, notes, and snippets.

@acannistra
Last active September 11, 2018 20:15
Show Gist options
  • Save acannistra/1204201c55b5f1ded166ae9c568106c7 to your computer and use it in GitHub Desktop.
Save acannistra/1204201c55b5f1ded166ae9c568106c7 to your computer and use it in GitHub Desktop.
Saving Work from GeoHackWeek JupyterHub

Preserving Your Work on JupyterHub

This week we're using a great service called JupyterHub, which allows everyone at GeoHackWeek to learn using the same computing environment. However, though you can edit the files and experiment with the the tutorial_contents repository that your personal jupyterhub contains, you won't be able to git push immediately. This is because the default version of the repo points to the geohackweek version on GitHub, and not your personal version.

Simply put: you might want to save your work. Here's how.

1. Open A Terminal on JupyterHub.

Navigate to https://jupyterhub.geohackweek.org/. Find the New dropdown menu, and click Terminal.

ot.png

You should see a terminal window.

term.png

2. Verify that you've forked tutorial_contents

Go to your GitHub account and make sure you've got a repository named tutorial_contents which you've forked from geohackweek/tutorial_contents.

If you don't see your own copy, go ahead and fork the geohackweek/tutorial_contents repository. Remember: this means that you now have a copy of the `tutorial_contents repo which contains

Questions? @tonyc on Slack, or ask an organizer.

3. Tell Git on JupyterHub about your fork.

When you git push, you're actually writing a short version of git push origin. This says to git: "hey, please push all of my local commits to the remote ("cloud") version of my code (which git has a name for: origin). The reason you can't run git push is because you don't have write access to origin (because it lives at github.com/geohackweek/tutorial_contents, not github.com/<your-username>/tutorial_contents).

What we'll do is setup another remote, called myversion.

First, in the terminal, make sure you've changed into the tutorial_contents directory (cd tutorial_contents).

Then, run this (replacing your GitHub username):

git remote add myversion https://www.github.com/<YOURUSERNAME>/tutorial_contents.git

To verify that this worked, you can run git remote -v:

jovyan@jupyter-acannistra:~/tutorial_contents$ git remote -v
myversion       https://github.com/acannistra/tutorial_contents.git (fetch)
myversion       https://github.com/acannistra/tutorial_contents.git (push)
origin  https://github.com/geohackweek/tutorial_contents.git (fetch)
origin  https://github.com/geohackweek/tutorial_contents.git (push)

If you see myversion lines, you're good!

4. Commit and push myversion.

To save any changes you make, you'll use the same techniques you learned yesterday, with one change.

git add --all
git commit -m "some sweet, sweet learning"
git push myversion

This will commit your changes and push them to your version of the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment