Spaces:
Sleeping
Sleeping
Fix: Rename master to main before push
Browse files
student/github_manager.py
CHANGED
|
@@ -154,6 +154,12 @@ class GitHubManager:
|
|
| 154 |
commit = repo.index.commit("Initial commit: Generated application")
|
| 155 |
commit_sha = commit.hexsha
|
| 156 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
# Add remote
|
| 158 |
remote_url = f"https://{settings.github_token}@github.com/{settings.github_username}/{repo_name}.git"
|
| 159 |
try:
|
|
|
|
| 154 |
commit = repo.index.commit("Initial commit: Generated application")
|
| 155 |
commit_sha = commit.hexsha
|
| 156 |
|
| 157 |
+
# Rename master to main if needed
|
| 158 |
+
try:
|
| 159 |
+
repo.git.branch("-M", "main")
|
| 160 |
+
except Exception:
|
| 161 |
+
pass # Already on main or error, continue
|
| 162 |
+
|
| 163 |
# Add remote
|
| 164 |
remote_url = f"https://{settings.github_token}@github.com/{settings.github_username}/{repo_name}.git"
|
| 165 |
try:
|