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
Cloning into 'example'...
remote: Enumerating objects: 11, done.
remote: Counting objects: 100% (11/11), done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 11 (delta 2), reused 4 (delta 1), pack-reused 0
Unpacking objects: 100% (11/11), done.
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."
[master 07192be] Emphatically stating that this is just an example.
 1 file changed, 1 insertion(+)

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
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 4 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 331 bytes | 331.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To https://github.com/kmpaul/example.git
   c7c2c77..07192be  master -> master

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.