Skip to content
Foxipa
Code Completion 4 Challenges

Complete the Git commands: Git Repository Creation and Cloning

Build a complete local laboratory without using a network service. First create an ordinary repository named `source-repo` with initial branch `main`, add and commit one file, then create a bare repository named `shared.git` and push `main` to it. Finally clone `shared.git` into `clone-repo`. Verify the clone rather than trusting the command's success message: prove that the current branch is `main`, the working tree is clean, `origin` points to `shared.git`, and the local HEAD matches `origin/main`. Then create a non-empty directory and confirm that attempting to clone into it fails without deleting its existing file.

Beginner ~6 min read

Challenge 1

Complete the Git command to create the clone.

bash Your answer
git 

Press Ctrl⌘Enter to check your answer

Challenge 2

Complete the Git command to create the clone.

bash Your answer
git  /path/to/shared.git project-copy

Press Ctrl⌘Enter to check your answer

Challenge 3

Complete the Git command to create the clone.

bash Your answer
git  /path/to/existing-repository new-copy

Press Ctrl⌘Enter to check your answer

Challenge 4

Complete the Git command to create the clone.

bash Your answer
git  /path/to/missing-repository missing-copy

Press Ctrl⌘Enter to check your answer