XK0-005 practice question 6 of 10

A Linux systems administrator is updating code. After completing the update, the administrator wants to publish the updated code without including the configuration files. Which of the following should the administrator use to accomplish this task?

Full set: 487 questions
Answer options
A: git clone
B: git -
C: .gitignore Correct answer
D: git fetch
Correct Answer:
C. .gitignore
Explanation

In Git version control management, developers frequently generate local configuration files, build artifacts, or secret files that should not be committed or shared publicly in source code repositories. The .gitignore file is a special text file placed in the repository root directory (or subdirectories) that specifies patterns for files and directories that Git must deliberately ignore. When code updates are published via commits and pushes, Git excludes any files matching rules defined inside .gitignore. Configuring .gitignore ensures sensitive configuration files remain on the administrator's local machine while allowing updated source code to be published cleanly. This represents standard operational best practices for maintaining code privacy and security across software deployment lifecycles.

Why Incorrect

A. git clone creates a copy of an existing remote Git repository onto a local system and does not manage file exclusion when publishing updates.
B. git - is an incomplete CLI syntax command and is not a valid Git operation or file configuration utility.
D. git fetch downloads objects and refs from another repository to update local tracking branches, rather than controlling file exclusion during code publication.

References

Pro Git, 2nd Edition (Scott Chacon and Ben Straub), Chapter 2: Git Basics - Ignoring Files.

Git Official Documentation, gitignore Manual Page (git-scm.com/docs/gitignore).

Scroll to Top