Creating Repositories, Templates, Settings, Visibility, Topics, and Default Branches: Configuration, Design Choices, and Tradeoffs
Choose repository ownership, visibility, initialization, default branches, templates, and merge settings by collaboration model, governance, recoverability, compatibility, and cost—not by form defaults.
Learning objectives
- Choose remote initialization versus pushing an existing local repository without creating accidental unrelated histories.
- Select template, ordinary starter repository, or fork based on required provenance and future synchronization.
- Choose personal versus organization ownership and public/private/internal visibility by governance and trust boundary.
- Treat default branch naming as an organization/repository convention with downstream automation consequences.
- Configure merge-commit, squash, and rebase availability as GitHub repository policy while distinguishing the resulting Git history shapes.
- Use a free-compatible decision framework that explicitly separates maintainability, security, governance, reliability, compatibility, and cost.
1. Configuration choices are contracts with future automation
Creation settings become assumptions. A CI workflow may target
main, deployment rules may reference the default
branch, documentation may embed OWNER/REPO, and a
template may seed hundreds of projects. The correct choice is
therefore the one whose semantics your team can maintain—not the one
that makes today’s creation form shortest.
A useful design review asks six questions: Who owns the asset? Who may see it? Where does initial history come from? What lineage must remain visible? Which branch is operationally default? Which merge histories will the repository accept? Then verify whether your account type, plan, and policies permit those choices.
2. Initialize on GitHub or push existing local history?
| Context | Choose | Why | Risk to control |
|---|---|---|---|
| No code/history exists yet |
Remote initialization can add
README/license/.gitignore.
|
Produces an intentional first commit and a usable default branch immediately. | Select the correct license/ignore template; do not seed secrets. |
| Local repository already has commits | Create empty hosted repository, then add remote and push. | Preserves one source of initial history. | Verify remote owner/name and target branch before first push. |
| Local files exist but are not yet a Git repository | Either path can work; decide who creates the authoritative first commit. | Avoids accidental parallel first histories. | Do not copy generated credentials/config into first commit. |
| Migration from another host | Use migration/import design, not casual README initialization. | History, refs, LFS, issues, releases, CI metadata may need separate treatment. | Inventory non-Git hosted state; deeper migration is covered later. |
The principle is single intentional genesis. If the remote and local sides both create their own first commit, Git correctly sees two unrelated histories. That is not corruption; it is evidence that two independent histories were created.
3. Template versus starter repository versus fork
| Model | Platform semantics | Choose when | Do not choose when |
|---|---|---|---|
| Template repository | Explicit GitHub template flag; generated repository begins independent history. | You need repeatable scaffolding for new independent services/projects. | You need future upstream changes to flow naturally through shared history. |
| Ordinary “starter repository” | No special relationship unless the repo is marked as a template or used by another product workflow. | Small team manually copies/clones boilerplate and accepts weak provenance. | You need reliable machine-readable derivation or policy at scale. |
| Fork | Repository-network relationship with upstream history. | You need contribution/synchronization relative to an upstream repository. | The new project should be independent and should not appear as a fork. |
At scale, explicit semantics beat naming conventions. If “starter” really means reusable scaffolding, convert the source to a template and document how updates are propagated—often through separate automation, not an assumed upstream merge relationship.
4. Personal versus organization ownership
| Dimension | Personal repository | Organization repository |
|---|---|---|
| Administrative continuity | Tied to one account owner; collaborators can be granted access. | Owned by organization; roles/teams/policies can outlive individual maintainers. |
| Access model | Personal-repository collaborator permissions. | Repository roles, teams, organization base permissions, optional custom/enterprise controls. |
| Policy scope | Primarily user/repository settings. | Organization and potentially enterprise policies can constrain creation/visibility/settings. |
| Best fit | Personal experiments, portfolio, individual open-source projects. | Shared company/team assets and governed multi-repository programs. |
| Migration concern | May later require transfer into an organization. | Transfer out can alter policy/plan context and may be prohibited. |
For a company service, organization ownership generally gives the right continuity boundary. The Git data is not “more enterprise” because of the owner; the governance surrounding that data is.
5. Visibility: optimize for the intended trust boundary
Public/private/internal is not a maturity ladder. It is a visibility decision. Public is appropriate for intentionally public source. Private is appropriate when access must be explicit. Internal supports enterprise-wide innersource in eligible Enterprise Cloud organizations. Choose the narrowest boundary that still serves the collaboration model, then apply security controls inside that boundary.
| Question | Public | Private | Internal (Enterprise Cloud) |
|---|---|---|---|
| Internet readable? | Yes | No | No |
| Requires explicit collaborator access for ordinary readers? | No | Yes | Enterprise members receive access according to internal-repository model/policy |
| Mandatory course path? | Yes, with synthetic data | Optional alternative, still free for personal account | No—optional enterprise design only |
| Discovery concern | Repository content and topics are public. | Content limited to authorized viewers; topic names are still public. | Enterprise-internal discovery / innersource. |
6. Default branch naming: convention, policy, and compatibility
GitHub currently defaults new content-bearing repositories to
main, but personal, organization, and enterprise
settings can define a different default name for new repositories.
Existing repositories can also select another existing branch as
default, subject to permissions and rules.
The branch name itself matters because tooling may hard-code it. Before standardizing a different name, search CI configuration, deployment manifests, scripts, documentation, branch rules, Pages sources, and external integrations. A consistent default reduces ambiguity, but changing a mature estate has migration cost.
| Choice | Maintainability | Compatibility | Governance note |
|---|---|---|---|
Use main for new repos |
Strong ecosystem convention; low surprise. | Broad current tooling compatibility. | Still verify organization/enterprise defaults. |
Use team-specific name such as trunk |
Can align with internal terminology. |
May require explicit configuration in tools/examples
expecting main.
|
Enforce/document centrally if consistency matters. |
| Change existing repository default branch | Can align mature repo with policy. | Does not rename local branches or hard-coded integrations automatically. | Inventory first; change GitHub setting and dependent systems deliberately. |
7. Merge feature settings are GitHub policy with Git history consequences
GitHub can allow merge commits, squash merging, and rebase merging for pull requests. These are repository settings controlling which merge operations GitHub offers. The resulting commits are still ordinary Git history, but the policy deciding which shapes are permitted is hosted state.
| Method allowed by repository | Resulting history shape | Operational tradeoff |
|---|---|---|
| Merge commit | Preserves branch commits and adds an explicit merge commit. | Strong topology/audit context; history can be noisier. |
| Squash merge | Combines the pull request into one commit on the base branch. | Clean one-change-per-PR history; loses original branch commit granularity in target history. |
| Rebase merge | Replays commits onto base without a merge commit. | Linear history while preserving individual commits; commit IDs change when rebased. |
Do not enable or disable a method only because it is fashionable. Consider rollback strategy, release-note generation, bisectability, authorship/audit expectations, and rules such as “require linear history.” Chapter 09 goes deeper into merge methods and merge queue behavior.
8. Read the effective design from GitHub CLI
gh repo view OWNER/REPO \
--json nameWithOwner,visibility,defaultBranchRef,mergeCommitAllowed,squashMergeAllowed,rebaseMergeAllowed,isTemplate,isFork,viewerPermission \
--jq '{nameWithOwner,visibility,defaultBranch:.defaultBranchRef.name,mergeCommitAllowed,squashMergeAllowed,rebaseMergeAllowed,isTemplate,isFork,viewerPermission}'
This is the preferred starting point for a design review because it turns UI settings into structured evidence. If the settings differ from your intended policy, first ask whether you have admin permission and whether organization/enterprise policy constrains the repository. “I cannot see the toggle” is not enough diagnosis.
9. Worked design decision: Atlas service repository
Assume a five-person DevOps team is creating a new internal service, but the course learner only has GitHub Free. The production recommendation and the free lab can differ while teaching the same reasoning.
| Dimension | Production choice | Free-course simulation | Justification |
|---|---|---|---|
| Owner | Organization | Personal disposable namespace | Production asset needs team continuity; lab avoids needing org admin. |
| Visibility | Private (or internal only if enterprise-wide innersource is intended and available) | Public synthetic repo or private personal repo | Protect proprietary code; course data contains no secret. |
| Initialization | Template-derived | Public personal template | Consistent scaffold without fork lineage. |
| Default branch |
main unless estate policy specifies otherwise
|
main/effective account default |
Low tooling surprise; verify instead of assuming. |
| Merge methods | Squash + merge commit or team-selected policy | Inspect/optionally configure disposable repo | Match rollback/audit/history needs; deeper governance later. |
| Cost | Use existing plan unless a required governance capability justifies upgrade | No paid dependency | Do not purchase plan merely to complete learning objective. |
The lesson is not that one row is universally correct. The lesson is that every choice has an explicit reason and a free-compatible way to practice the underlying model.
10. Product boundaries: Git, GitHub, Actions, and external systems
| Layer | Owns what in this chapter? | Example |
|---|---|---|
| Core Git | Objects, commits, refs, local remotes/configuration. | A branch rename changes a Git ref; a commit produces an OID. |
| GitHub repository | Owner/name, visibility, default branch setting, template status, topics, merge-method availability. | gh repo edit --add-topic. |
| GitHub Actions | Workflow execution/settings, later built on repository events/refs. |
A workflow referencing main may need update
after branch migration.
|
| External cloud/registry/IdP | Independent identities/resources/policies. | Renaming a GitHub repo does not automatically update an external deployment system webhook URL. |
11. Common design anti-patterns
- Create first, decide owner later: creates avoidable transfer work and policy drift.
- Initialize both remote and local: creates two intentional but unrelated histories that then need reconciliation.
- Use a fork as a template: keeps an upstream/network relationship that an independent service may not want.
- Call any copied repo a template: hides the absence of explicit platform provenance.
- Change default branch before dependency inventory: breaks hard-coded automation even though GitHub setting itself succeeds.
- Enable every merge method: pushes governance decisions onto individual PR authors and makes history less predictable.
12. Design exercise before mutation
Write a one-page repository provisioning decision for a fictional
service. Include: intended owner, visibility, initialization source,
template/fork rationale, default branch, merge methods,
README/license/.gitignore policy, topics, lifecycle
owner, and the exact free-course simulation. Then use
gh repo view against one disposable repository to
compare declared versus effective settings.
13. Verification checklist
- Your initialization choice creates only one intentional first history.
- Your template/fork/starter decision matches required provenance and future synchronization.
- Ownership matches the administrative continuity model.
- Visibility matches the actual trust boundary and plan/deployment availability.
- Default branch name is verified rather than assumed and dependencies are identified before changing it.
- Merge methods are justified by history/reliability/audit needs rather than convenience.
- The mandatory learning path works without Team/Enterprise/paid security products.
Knowledge check
A company wants 50 independent services from one scaffold. Fork or template?
Template is the better GitHub repository relationship: each service begins independently from standardized content without joining a fork network.
Why can an empty remote be safer than a README-initialized remote for an existing local project?
It avoids creating a second unrelated first commit/history before the local project is pushed.
An enterprise has an internal repository option. Should every private service become internal?
No. Internal broadens visibility to enterprise members under that model. Choose it only when enterprise-wide innersource is intended; private remains appropriate for narrower access.
A team changes GitHub’s default branch from
main to trunk. What must still be
inventoried?
Local clone branch names, CI/deploy scripts, branch rules, Pages/configuration, documentation, webhooks/integrations, and any other system that hard-codes the old name.
Why might a team allow only squash merging?
To create one target-branch commit per pull request and keep history linear/compact, accepting the loss of individual PR-branch commit granularity in target history.
14. Summary
Repository design is a set of explicit contracts: ownership defines administrative continuity; visibility defines who may read; initialization defines history genesis; template/fork semantics define lineage; the default branch guides hosted operations; merge settings constrain allowed PR history shapes.
The production pattern is declare → verify availability/policy → provision → inspect effective state. The next lesson applies the same discipline when creation goes wrong or repository identity changes.
Authoritative references
Creating a new repository
Creating a template repository
Creating a repository from a template
Forks
About repositories — GitHub Enterprise Cloud
Setting repository visibility
Changing the default branch
Managing the default branch name for your repositories
Configuring pull request merges
Pull request merges
Repository roles for an organization
gh repo edit
Keep the academy open
Support free, practical DevOps education.
Every lesson is designed to remain readable in a browser, downloadable from GitHub, and usable without a paid learning platform. Contributions help expand and maintain the curriculum.
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0
Send only Ethereum/ERC-20 compatible assets to this
address.