Why I am Getting "error: pathspec 'XXX' did not match any file(s) known to git" While Doing a Git SCM Update on Ansible Tower ?

Solution Verified - Updated -

Environment

Ansible Tower

Issue

Getting following error in Ansible Tower while doing an Git SCM update in Project :

 "stderr_lines": [
        "error: pathspec 'None' did not match any file(s) known to git."
    ]

Resolution

  • While creating the scm project on Ansible Tower, please use the correct branch name of the Git repo in SCM BRANCH/TAG/COMMIT field. ( SCM Branch/Tag/Commit - Optionally enter the SCM branch, tags, commit hashes, arbitrary refs, or revision number (if applicable) from the source control (Git, Subversion, or Mercurial) to checkout.)

  • If you are using the master branch then leave SCM BRANCH/TAG/COMMIT empty.

  • Try enabling the options CLEAN and DELETE ON UPDATE in your current project configuration and try to perform the sync again.
    Clean - Removes any local modifications prior to performing an update.
    Delete on Update - Deletes the local repository in its entirety prior to performing an update. Depending on the size of the repository this may significantly increase the amount of time required to complete an update.

Root Cause

Incorrect Git repository branch name or local changes in the repository.

  • Component
  • git

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.