Courseiva
hardMultiple ChoiceObjective-mapped

XK0-006 Practice Question: A DevOps engineer managing a Git repository for a…

You are a DevOps engineer managing a Git repository for a large development team. Your CI/CD pipeline runs automated tests on every push. Recently, developers have been pushing commits that break the build. You need to enforce that all commits pass the tests before being pushed to the remote repository. Which Git hook should you implement on the client side?

⚠ Common exam trap

CompTIA often tests the distinction between client-side and server-side hooks, and the trap here is that candidates confuse pre-receive (server-side) with pre-push (client-side), thinking any hook that runs 'before receive' will block the push on the client.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

pre-push

The pre-push hook (option D) runs after a `git push` command is issued but before the data is actually sent to the remote repository. This allows you to run tests locally and abort the push if they fail, enforcing that only commits that pass tests are pushed. It is the correct client-side hook for this requirement.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • pre-receive

    Why it's wrong here

    This is a server-side hook, not client-side; you need a hook on the developers' machines.

  • pre-commit

    Why it's wrong here

    Pre-commit runs before the commit is created; developers might still push commits that were created before tests were added.

  • post-commit

    Why it's wrong here

    Post-commit runs after commit but does not block the push; broken commits would still be pushed.

  • pre-push

    Why this is correct

    Pre-push runs after commit but before push, ensuring tests pass before code leaves the local machine.

About these practice questions

Courseiva writes every XK0-006 question from scratch — 979 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This XK0-006 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the XK0-006 exam.