4 ms·
Yeah, ive had issues with repos on github having master and new ones having main. Github api seems to force the default branch to main (on new repos) making fix
by totony 5y ago
Yeah, ive had issues with repos on github having master and new ones having main. Github api seems to force the default branch to main (on new repos) making fixing this harder as well.
It's not that big of a deal but sure is a hassle.
- wutbrodo 5y ago> Github api seems to force the default branch to main (on new repos) Jesus, really? I didn't pay much attention to the master nonsense because I figured it would be limited to projects who cared more about social performance than building something useful, but it sounds like it's being forced at the platform-level onto every project. OTOH, the impact is mitigated for new projects
- totony 5y agoI may have misspoken, you can change the default branch after the fact, my issue was with the "auto-create README" feature
- Grollicus 5y agoI just created a new repo with just a master branch. Where does Github force anything? They're sure suggesting it - their suggested commands to initialize a new repo will create a main branch. But you can just ignore that suggestion?
- Jiejeing 5y agoedit: my bad, I expected it to be the case but it turns out I had it in my gitconfig instead. They are just going along the git default, so yes, a new repo will be on main branch by default.
- JimDabell 5y agoNo, the Git default is still master. GitHub changed their default to main.
- zerocrates 5y agoIt's just that, and the "create a first commit/branch/README for me" thing it can do presumably does that with "main" now also.
- totony 5y agoAs @zerocrates mentioned, it's about the github auto commit feature when creating a new repo. This makes bootstrapping using terraform more complicated.
- JimDabell 5y agoPerhaps you missed that the person you are replying to was talking about the GitHub API and not their web interface? Here’s the API reference: https://docs.github.com/en/rest/reference/repos#create-an-organization-repository https://docs.github.com/en/rest/reference/repos#create-an-or... I don’t see any parameter for setting the default to master instead of main. However it does seem like you can change it after it has been created with a subsequent update call.
- Grollicus 5y agoI'd expect you'd still create an empty repo (same as in the web UI) and then push the branches you want to push. You don't configure a branch name in the web ui as well. But that's why I'm asking where OP found that and not just saying they're wrong. €: There's also https://docs.github.com/en/rest/reference/repos#update-a-repository https://docs.github.com/en/rest/reference/repos#update-a-rep... where you can set the default_branch?