Skip to main content

max / makenotwork

Fix default branch for auto-created bare repos git init --bare now uses -b main so new repos default to main instead of master. Fixes git clone failing to checkout when the only branch is main but HEAD points to master. Also fixed HEAD in all 12 existing bare repos on hetzner. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author: Max J. <87768334+MaxJMath@users.noreply.github.com> · 2026-05-05 20:46 UTC
Commit: b01eea8a4b02c624576aa914067af3e32ff153c7
Parent: 36a75ef
1 file changed, +1 insertion, -1 deletion
@@ -306,7 +306,7 @@ impl russh::server::Handler for MnwHandler {
306 306 // gets git group ownership. Avoids systemd security
307 307 // restrictions that block sudo child processes.
308 308 match tokio::process::Command::new("git")
309 - .args(["init", "--bare", "--shared=group", &auth.repo_path])
309 + .args(["init", "--bare", "--shared=group", "-b", "main", &auth.repo_path])
310 310 .stdout(std::process::Stdio::null())
311 311 .stderr(std::process::Stdio::null())
312 312 .status()