Summary - Security
- Git course
- Expert
- Lesson 28/32
- 5 min
Combine security steps to set up a signed and recoverable repository.
A secure and recoverable repository
A secure Git environment consists of several complementary measures. GPG signatures help verify commit origins. SSH keys provide secure access to remote servers. Regular backups provide a way to recover from data loss.
GPG signing → Commit verification
SSH keys → Secure access
Backup → RecoveryWhen these measures are applied together, the repository becomes both more secure and more resilient to failures.
Practice Combine security settings and backup
Enable default GPG commit signing in the Git repository and select the ABCD1234 key. Then set the remote repository URL to its SSH format and create a mirror backup named project-backup.git from the current repository. Finally, print a completion message.
Starter code
# GPG imzalamayı etkinleştir ve anahtarı seç
# Uzak adresi SSH biçimine getir
# Ayna yedeği oluşturSample solution
git config commit.gpgsign true
git config user.signingkey ABCD1234
git remote set-url origin git@github.com:team/project.git
git clone --mirror . project-backup.git
echo "Güvenlik ve yedekleme yapılandırması tamamlandı."Expected output
Güvenlik ve yedekleme yapılandırması tamamlandı.
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 You are setting up signed commits, SSH access, and disaster recovery for a new project. Which plan correctly addresses all three goals?
- Disable commit signing and rely only on local history
- Sign commits with GPG, connect with an SSH key, and keep an independent repository backup Correct answer
- Use one password and store only the working directory
- Share the SSH private key publicly and avoid backups
Explanation: GPG signing, SSH keys, and independent backups address different security needs and should be used together.
2 Choose the secure access method
git remote set-url origin ____git@github.com:team/project.git
git remote set-url origin sshgit@github.com:team/project.git
Explanation: The SSH format in a remote repository URL allows authentication with an SSH key instead of a password.
3 Security and recovery summary
| Term | Meaning |
|---|---|
GPG signing |
Helps verify commit signatures |
SSH key |
Key-based access to a remote server |
Disaster recovery |
Restores service after a failure |
Mirror backup |
Keeps a full copy of repo references |