@@ -163,6 +163,11 @@ fn github_setup_clones_existing_repo() -> Result<()> {
163163 . args ( [ "init" , "--bare" ] )
164164 . current_dir ( & remote_path)
165165 . output ( ) ?;
166+ // Set default branch to main so clone checks out the right branch
167+ std:: process:: Command :: new ( "git" )
168+ . args ( [ "symbolic-ref" , "HEAD" , "refs/heads/main" ] )
169+ . current_dir ( & remote_path)
170+ . output ( ) ?;
166171
167172 // Create a temp repo to push initial content
168173 let temp_repo = base. join ( "temp" ) ;
@@ -290,6 +295,11 @@ fn github_clone_empty_repo() -> Result<()> {
290295 . args ( [ "init" , "--bare" ] )
291296 . current_dir ( & remote_path)
292297 . output ( ) ?;
298+ // Set default branch to main so clone checks out the right branch
299+ std:: process:: Command :: new ( "git" )
300+ . args ( [ "symbolic-ref" , "HEAD" , "refs/heads/main" ] )
301+ . current_dir ( & remote_path)
302+ . output ( ) ?;
293303
294304 // Need to create an initial commit for clone to work
295305 let temp_repo = base. join ( "temp" ) ;
@@ -471,6 +481,11 @@ fn github_clone_existing_dotstate_repo() -> Result<()> {
471481 . args ( [ "init" , "--bare" ] )
472482 . current_dir ( & remote_path)
473483 . output ( ) ?;
484+ // Set default branch to main so clone checks out the right branch
485+ std:: process:: Command :: new ( "git" )
486+ . args ( [ "symbolic-ref" , "HEAD" , "refs/heads/main" ] )
487+ . current_dir ( & remote_path)
488+ . output ( ) ?;
474489
475490 // Create temp repo with dotstate structure
476491 let temp_repo = base. join ( "temp" ) ;
0 commit comments