Challenge - 5 Problems
Git Clone Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
Output of cloning a public Git repository
What is the output when you run
git clone https://github.com/octocat/Hello-World.git in an empty directory?Git
git clone https://github.com/octocat/Hello-World.git
Attempts:
2 left
💡 Hint
Think about what happens when cloning a valid public repository into an empty folder.
✗ Incorrect
When cloning a valid public repository, git shows progress messages including enumerating, counting, compressing, receiving objects, and resolving deltas. Errors occur only if the repo is missing or the destination folder is not empty.
🧠 Conceptual
intermediate1:30remaining
Understanding git clone default behavior
When you run
git clone https://github.com/user/repo.git without specifying a folder name, where does Git clone the repository?Attempts:
2 left
💡 Hint
Think about the folder Git creates by default when cloning.
✗ Incorrect
By default, Git creates a new folder named after the repository (without .git) in the current directory and clones the content there.
❓ Troubleshoot
advanced2:00remaining
Error when cloning into a non-empty directory
You run
git clone https://github.com/user/project.git existing_folder but get an error. What is the most likely cause?Attempts:
2 left
💡 Hint
Git does not allow cloning into folders that already have files.
✗ Incorrect
Git refuses to clone into a folder that exists and is not empty to avoid overwriting files. The error message indicates this problem.
🔀 Workflow
advanced2:30remaining
Cloning a repository with a specific branch
Which command clones only the branch named 'feature' from the repository
https://github.com/user/repo.git?Attempts:
2 left
💡 Hint
Use options to limit cloning to a single branch.
✗ Incorrect
The correct syntax to clone a specific branch only is using --branch with --single-branch. Option A clones the branch but also fetches all branches unless --single-branch is specified. Options A and C are invalid.
✅ Best Practice
expert3:00remaining
Choosing the best clone option for a large repository
You need to clone a very large repository but only want the latest commit history to save time and space. Which command is best?
Attempts:
2 left
💡 Hint
Shallow clone limits history depth.
✗ Incorrect
Using --depth 1 creates a shallow clone with only the latest commit, reducing download size and time. --single-branch clones all history of one branch, --bare creates a repository without working files, and --recursive clones submodules.