@@ -610,7 +610,9 @@ def api_push_git(site_id: str, body: PushGit):
610610 env ["GIT_COMMITTER_EMAIL" ] = "pleng@automated.dev"
611611
612612 def _git (* args ):
613- r = subprocess .run (["git" ] + list (args ), cwd = workspace , capture_output = True , text = True , env = env , timeout = 30 )
613+ r = subprocess .run (["git" ] + list (args ), cwd = workspace , capture_output = True , text = True , env = env , timeout = 60 )
614+ if r .returncode != 0 and "already exists" not in r .stderr :
615+ logger .error (f"git { ' ' .join (args )} failed: { r .stderr [:300 ]} " )
614616 return r
615617
616618 # Fix ownership issue (agent creates files as uid 1000, platform-api runs as root)
@@ -627,8 +629,12 @@ def _git(*args):
627629
628630 # Add, commit, push
629631 _git ("add" , "-A" )
630- _git ("commit" , "-m" , body .message , "--allow-empty" )
631- result = _git ("push" , "-u" , "origin" , "main" )
632+ commit_result = _git ("commit" , "-m" , body .message , "--allow-empty" )
633+ push_result = _git ("push" , "-u" , "origin" , "main" )
634+
635+ if push_result .returncode != 0 :
636+ error = push_result .stderr [:300 ]
637+ raise RuntimeError (f"git push failed: { error } " )
632638
633639 repo_url = f"https://github.com/{ repo } "
634640 db .update_site (site ["id" ], github_url = repo_url )
0 commit comments