Clones
Now, let’s go back to our example
repositories home page.
Note: You can also just as easily put into your browser the URL:
https://github.com/[username]/example
Now, let’s click on the “Clone or download” button and then copy the URL for this repository onto your clipboard.
Next, let’s create a clone of this repository where we currently are located (in this notebook).
cd
if [ -d example ]; then
rm -rf example
fi
git clone https://github.com/kmpaul/example.git
cd example
Let’s add a new line to our README.md
file.
echo "Really, this is just an example." >> README.md
Now we can commit this change to our clone.
git add README.md
git commit -m "Emphatically stating that this is just an example."
And finally, we can push
our changes (without any complications!) to GitHub.
Note: If this is your first time pushing to GitHub, then it will try to authenticate with your username and password. This doesn’t work with Jupyter Notebook, so you may have to do this step in a separate terminal.
git push
And we’re done! If you go to your GitHub repository’s home page, you can click the “commits” link to see your new commit, and you should see the change added to the README.md
file.