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.
Navigate to https://jupyterhub.geohackweek.org/. Find the New
dropdown menu, and click Terminal
.
You should see a terminal window.
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.
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!
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.