Lesson 7
Objects and Dictionaries
Chapter 8: Robots and remote clones
Cloning a remote repository
My remote repository for my robot project is hosted on our departmental Gitlab server. I have made it publicly accessible to anyone on the Internet.
If you look at my repo on Gitlab, you can see a “Clone” button on the main page (see figure below). If you click on the “Clone” button, you will get two options: “Clone with SSH” and “Clone with HTTPS”.
We will go with “Clone with HTTPS” for this lesson, because I find that it is more likely to work in general. The SSH option is more involved, and will require you to set up some keys etc. on a Unix-based machine, plus it is not quite suitable for what I am currently trying to do (share my repo).
Copy the link under “Clone with HTTPS”, which is https://gitlab.doc.ic.ac.uk/jwang4/70053-robot.git.
Now, go to your command line terminal, and use the git clone
command to clone my repository to your hard drive. You can also optionally customise the name of the directory to where you are saving your local copy (josiah-robot
in my example below), otherwise it will automatically name it as 70053-robot
by default (that’s the name of my project). You can then find your local copy of my repo in the josiah-robot
directory (or whatever you named it).
user@MACHINE:~$ git clone https://gitlab.doc.ic.ac.uk/jwang4/70053-robot.git josiah-robot
Cloning into 'josiah-robot'...
remote: Enumerating objects: 43, done.
remote: Counting objects: 100% (43/43), done.
remote: Compressing objects: 100% (34/34), done.
remote: Total 43 (delta 12), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (43/43), 10.51 KiB | 1.31 MiB/s, done.
Resolving deltas: 100% (12/12), done.
user@MACHINE:~$ cd josiah-robot
user@MACHINE:~/josiah-robot$ ls
main.py robot_names.txt
user@MACHINE:~/josiah-robot$
Congratulations! You now have a local copy of my robot project repository on your hard drive. Feel free to look around (but not ahead!), navigate to any previous commits and examine my implementation etc. You can even edit anything you like without affecting my remote copy - this is your own local copy. You can even delete this directory if you no longer need it.
In future lessons, we will talk about how you can keep a remote repository up to date, and upload any new commit you made to your local copy to be in sync with the remote repository.
Obviously, I have control over my remote repository, and have no plans to approve any changes to it! 😀