sudo apt install git
git config --global user.email "yourname@domain.xyz"
git config --global user.name "yourname"
git config --global init.defaultBranch main
Apparently you should commit .gitignore to your repository, for the benefit of others.
To exclude local junk files, without mentioning them in .gitignore:
vi .git/info/exclude
*.bak
.vscode
.backups