Skip to content

lab 45 Cloning Repositories

Goals

Go to the work directory

Go to the working directory and make a clone of your hello repository.

Execute:

cd ..
pwd
ls

NOTE: Now in the work directory.

Output:

$ cd ..
$ pwd
/Users/jim/Downloads/git_tutorial/work
$ ls
hello

At this point you should be in your “work” directory. There should be a single repository here named “hello”.

Create a clone of the hello repository

Let’s make a clone of the repository.

Execute:

git clone hello cloned_hello
ls

Output:

$ git clone hello cloned_hello
Cloning into 'cloned_hello'...
done.
Note: switching to '7d55044c68b2827a88297c1c44afc61792577352'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

$ ls
cloned_hello
hello

There should now be two repositories in your work directory: the original “hello” repository and the newly cloned “cloned_hello” repository.