CertGrid CertGrid
Hands-on Lab·Ansible

Ansible Git Repository Cloning

EX294 expects you to clone a repository and work in it. The clone itself is one command; the part that costs people time is that cloning an empty repository takes its branch name from your machine, not from the server - so a repo created with main hands you master, and the first push fails.

Templates, Files and Vault Guide 22 of 45 Beginner

Git 2.53 still defaults init.defaultBranch to master and prints a hint saying it changes in Git 3.0. Until then the mismatch below is the default behaviour on a fresh machine, not a misconfiguration.

The control node, and ANS-B01 standing in for a Git server. Any host you can reach over SSH will do.
Server NameIP AddressOSRolesCPURAMHDD
ANS-CTL01192.168.0.36Ubuntu 26.04 LTSAnsible Control Node2 Core3 GB50 GB
ANS-B01192.168.0.38Ubuntu 26.04 LTSManaged Node (group: db)2 Core3 GB50 GB

This guide includes

Use this because EX294 expects you to clone a repository and work inside it. This matters because the first push fails on a branch name - and knowing that in advance saves the time it otherwise costs you.

Before you start

  1. The configuration this guide assumes

  2. A repository to clone from

  3. Clone it

  4. Identity, then a first commit

  5. Fix the branch, then push

  6. Prove it round-trips

  7. Pull someone else's change

Official sources