When importing old repos containg a "master" branch and other branches, default branch not set to "master" #67129
Unanswered
andrewpmk
asked this question in
Repositories
Replies: 3 comments
This comment was marked as spam.
This comment was marked as spam.
-
You can automate the default branch change using GitHub's API. After importing the repository, run this script to set the default branch to "master": curl -X PATCH \
-H "Authorization: token YOUR_GITHUB_ACCESS_TOKEN" \
https://api.github.com/repos/OWNER/REPO \
-d '{"default_branch":"master"}' Replace YOUR_GITHUB_ACCESS_TOKEN, OWNER, and REPO with the appropriate values. You can integrate this into your import workflow to automatically set the default branch to "master" for each imported repository. For more details, check out GitHub's API documentation on updating repositories. |
Beta Was this translation helpful? Give feedback.
0 replies
This comment was marked as spam.
This comment was marked as spam.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Select Topic Area
Question
Body
I am importing a bunch of old git repos from another git server to GitHub. The main branch is "master" on those repos and I don't want to change them to "main" at this time.
When I import these repos GitHub should set the default branch to "master", recognizing that there is no "main" branch and this probably should be set to the default branch. Instead it is set to something else and I need to go through each repo and change it manually:
Beta Was this translation helpful? Give feedback.
All reactions