200-901 Question 22
Single answerYou are working on a Python automation project hosted in a Git repository. Your team requests you to create a local copy of the repository on your system to contribute to the project. Which Git command should you use to accomplish this?
- A
git copy https://github.com/example/repo.git
- B
git clone https://github.com/example/repo.git
- C
git init https://github.com/example/repo.git
- D
git fetch https://github.com/example/repo.git
Show answer and explanation
Correct answer: B
Explanation
'git clone' is the appropriate command to create a local copy of a remote Git repository. It clones all the files, branches, and commit history from the remote repository to your local machine, enabling you to work on the project locally.
- A. Incorrect.
This is incorrect because 'git copy' is not a valid Git command.
- B. Correct.
This is correct because 'git clone' is the command used to create a local copy of a remote repository.
- C. Incorrect.
This is incorrect because 'git init' initializes a new, empty repository and does not fetch an existing repository.
- D. Incorrect.
This is incorrect because 'git fetch' only retrieves changes from a remote repository but does not create a local copy of the repository.