ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 224 - XK0-005 discussion

Report
Export

Application code is stored in Git. Due to security concerns, the DevOps engineer does not want to keep a sensitive configuration file, app . conf, in the repository. Which of the following should the engineer do to prevent the file from being uploaded to the repository?

A.
Run git exclude app. conf.
Answers
A.
Run git exclude app. conf.
B.
Run git stash app. conf.
Answers
B.
Run git stash app. conf.
C.
Add app . conf to . exclude.
Answers
C.
Add app . conf to . exclude.
D.
Add app . conf to . gitignore.
Answers
D.
Add app . conf to . gitignore.
Suggested answer: D

Explanation:

This will prevent the file app.conf from being tracked by Git and uploaded to the repository. The .gitignore file is a special file that contains patterns of files and directories that Git should ignore. Any file that matches a pattern in the .gitignore file will not be staged, committed, or pushed to the remote repository. The .gitignore file should be placed in the root directory of the repository and committed along with the other files.

The other options are incorrect because:

A) Run git exclude app.conf

This is not a valid Git command. There is no such thing as git exclude. The closest thing is git update-index --assume-unchanged, which tells Git to temporarily ignore changes to a file, but it does not prevent the file from being uploaded to the repository.

B) Run git stash app.conf

This will temporarily save the changes to the file app.conf in a stash, which is a hidden storage area for uncommitted changes. However, this does not prevent the file from being tracked by Git or uploaded to the repository. The file will still be part of the working tree and the index, and it will be restored when the stash is popped or applied.

C) Add app.conf to .exclude

This will have no effect, because Git does not recognize a file named .exclude. The only files that Git uses to ignore files are .gitignore, $GIT_DIR/info/exclude, and core.excludesFile.

Git - gitignore Documentation

.gitignore file - ignoring files in Git | Atlassian Git Tutorial

Ignoring files - GitHub Docs

[CompTIA Linux+ Certification Exam Objectives]

asked 02/10/2024
Antonios Petropoulos
32 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first