GitHub Platform Foundations, Plans, Accounts, Organizations, and Repository Models: Guided Hands-On Workflow and Core Operations
Create a free-compatible disposable GitHub repository, inspect it through the web UI, GitHub CLI, REST API, and local Git, then verify one controlled ref change end to end.
Learning objectives
- Create a disposable public repository without assuming a default branch name.
- Map Code, Issues, Pull requests, Actions, Projects, Security, Insights, and Settings to the resources they expose.
- Use gh auth status safely and inspect repository metadata with documented JSON fields.
- Use a versioned read-only REST request and understand why API version selection matters.
- Connect GitHub-hosted repository state to local clone/remotes/refs and verify an exact pushed commit SHA.
- Choose UI, CLI, API, or Git based on the state being questioned rather than on habit.
\, command substitution such as
$(...), test, printf, or
tee are labeled for Git Bash/Bash/zsh. On PowerShell, run
the same git/gh arguments on one line or use
PowerShell's backtick for continuation; use PowerShell-native
file/evidence commands where an equivalent is shown. The GitHub
resource semantics are the same across shells.
1. Scenario and safety model
In this lesson you will create a disposable repository named
github-platform-lab under your personal account. The
mandatory path uses public visibility because it works with GitHub
Free and keeps plan dependencies minimal. Put only synthetic
learning content in it.
gh, every required
state can still be inspected in the web UI plus local Git; REST
inspection of public repository metadata can also be done with
curl.
2. Preflight: inspect tools and active identity before creating anything
Start with state that cannot mutate a repository:
git --version
gh --version
gh auth status --active --hostname github.com
If gh is not installed, use the web path below. If it
is installed but not authenticated, follow the official
gh auth login flow locally. Do not paste tokens,
recovery codes, or SSH private keys into lesson notes or prompts.
--show-token. The CLI
supports a token-display option for debugging, but displaying a
token would violate the lab's evidence hygiene. Authentication state
is enough.
3. Create the disposable repository
Option A — GitHub web UI
- Use the repository creation flow on GitHub.com.
- Owner: your personal account.
- Name:
github-platform-lab. - Visibility: Public.
- Initialize it with a README so a default branch exists immediately.
- Before submitting, predict what new hosted state will exist: a repository resource plus an initial Git commit/ref.
Option B — GitHub CLI
gh repo create github-platform-lab --public --add-readme --clone
The command creates a GitHub repository owned by the active
authenticated user, initializes it with a README, and clones it. It
does not create an organization, team, issue, or pull request. The
default branch name comes from the account/repository creation
configuration, so the lesson deliberately does not assume
main or master.
4. Read the repository's major surfaces in the web UI
Open the repository. GitHub's repository navigation exposes different views of the same repository resource. Exact tab visibility can depend on enabled features, permissions, viewport, and product changes, so treat names as current navigation—not as a permanent wire protocol.
| Surface | What it primarily represents | Git object? |
|---|---|---|
| Code | Hosted branches/tags/files/commits and repository browsing | Displays Git-backed data plus hosted metadata. |
| Issues | Work items, discussion, labels, milestones | No. |
| Pull requests | Proposed changes, review state, checks, merge coordination | Not itself; it references Git commits/refs. |
| Actions | Workflow definitions/runs/jobs/logs | Workflow files can be Git content; run state is hosted. |
| Projects | Planning/roadmap views and fields | No. |
| Security | Security configuration/alerts/features available to this repository | No. |
| Insights | Repository activity/traffic/dependency/community views as available | Mostly hosted/derived views. |
| Settings | Repository administration and feature configuration | No; requires sufficient permission and may appear in an overflow menu. |
Your first task is not to click everything. Record which surfaces exist and what resource each surface represents.
5. Inspect hosted repository state with structured GitHub CLI output
From any directory, replace YOUR_USER with your account
name:
gh repo view YOUR_USER/github-platform-lab \
--json nameWithOwner,visibility,defaultBranchRef,isInOrganization,viewerPermission,hasIssuesEnabled,hasProjectsEnabled,isArchived,url \
--jq '{name: .nameWithOwner, visibility, defaultBranch: .defaultBranchRef.name, inOrganization: .isInOrganization, permission: .viewerPermission, issues: .hasIssuesEnabled, projects: .hasProjectsEnabled, archived: .isArchived, url}'
Prefer this machine-readable form to scraping the CLI's decorative default output. Important fields:
-
nameWithOwneridentifies the resource unambiguously. -
visibilitytells you public/private/internal hosted visibility. -
defaultBranchRef.namereports the configured default branch without assuming its name. -
isInOrganizationdistinguishes personal from organization ownership. -
viewerPermissionreports the effective repository role GitHub exposes for the authenticated viewer.
6. Inspect the same resource through the REST API
Inside the cloned repository, gh api can substitute
{owner} and {repo} from repository
context. Explicitly select the current API version:
gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2026-03-10" \
'repos/{owner}/{repo}' \
--jq '{full_name, visibility, default_branch, private, archived, has_issues, has_projects, owner: .owner.login}'
As of this lesson's verification date, GitHub's REST API supports
2026-03-10 and 2022-11-28. Requests
without an explicit version default to an older supported version,
which is precisely why production integrations should select a
version intentionally and test upgrades.
If you use raw curl against a public repository, you
can omit authentication, but unauthenticated requests have a much
lower primary rate limit. The course does not need a personal access
token for this chapter.
7. Connect GitHub-hosted state to a local Git clone
If you created the repository in the web UI, clone it now:
gh repo clone YOUR_USER/github-platform-lab
cd github-platform-lab
If you used --clone during creation, enter the
directory. Then inspect local state before changing it:
git remote -v
git branch --show-current
git status --short --branch
git log --oneline --decorate --graph --all -5
git ls-remote --symref origin HEAD
git remote -v reads local remote configuration.
git branch --show-current reads local HEAD state.
git ls-remote --symref origin HEAD asks the remote
repository what symbolic ref its HEAD advertises. This is Git
protocol state, not an Issues or permissions query.
8. Make one small Git change and prove causality
Configure a safe lab identity locally if needed. The email is deliberately non-routable and is commit metadata, not a GitHub credential.
git config user.name "Learner Example"
git config user.email "learner@example.invalid"
git switch -c platform-map
printf "GitHub platform lab\n" > platform-map.txt
git add platform-map.txt
git diff --cached -- platform-map.txt
git commit -m "docs: add platform map marker"
LOCAL_OID=$(git rev-parse HEAD)
printf 'local commit: %s\n' "$LOCAL_OID"
git push -u origin platform-map
PowerShell equivalent for the file/variable steps
git config user.name "Learner Example"
git config user.email "learner@example.invalid"
git switch -c platform-map
"GitHub platform lab" | Set-Content platform-map.txt
git add platform-map.txt
git diff --cached -- platform-map.txt
git commit -m "docs: add platform map marker"
$LOCAL_OID = git rev-parse HEAD
"local commit: $LOCAL_OID"
git push -u origin platform-map
Prediction before the push: the local commit already exists; the
push should create/update the hosted
platform-map branch ref and transfer any missing
objects. It should not change the repository
default branch, create an issue, change visibility, or grant a
permission.
Verify independently:
gh api \
-H "X-GitHub-Api-Version: 2026-03-10" \
'repos/{owner}/{repo}/commits/platform-map' --jq .sha
git rev-parse HEAD
The two commit IDs should match. The same commit identity is now observable locally and through GitHub's hosted API.
9. Inspect access without granting anything
For a personal repository you own, GitHub will normally expose your viewer permission as administrative. Do not turn this into an exercise in adding random collaborators. The goal is to observe the boundary, not widen it.
gh repo view --json nameWithOwner,viewerPermission,isInOrganization \
--jq '{repo: .nameWithOwner, permission: .viewerPermission, organizationOwned: .isInOrganization}'
If you already have access to a disposable organization, you may optionally inspect its repository's People/Teams access settings without changing them. That extension is not required. Organization role management belongs to later governance chapters.
10. Build a hosted-state record
Create a local file named hosted-state.txt outside the
repository or keep it as notes. Record:
- Repository coordinate.
- Account owner type: personal or organization.
- Visibility.
- Default branch.
- Your effective permission.
- Whether Issues and Projects are enabled.
-
Current pushed branch
platform-mapand its commit ID. -
GitHub host (
github.comfor the mandatory path).
This is the beginning of an operational habit: capture resource identity and state before modifying settings.
11. UI, CLI, API, and Git: choose the interface that matches the question
| Question | Best first interface | Why |
|---|---|---|
| What branch am I on locally? | Git | This is local HEAD state. |
| What is the repository's configured default branch? | gh repo view --json or REST/UI |
This is hosted repository configuration. |
| What is the exact commit on a hosted branch? | Git refs/API | Both can expose immutable commit identity. |
| What permission does my GitHub account have? | GitHub CLI/API/UI | Core Git does not know GitHub roles. |
| Where are workflow logs? | GitHub Actions UI/CLI/API | Run logs are hosted state, not Git history. |
12. Challenge: choose the right surface before touching the repository
For each question, name the interface/resource you would inspect first. Do not run a mutation.
- “Which commit is my local branch on?”
- “Can this account administer repository settings?”
- “Which branch does GitHub consider the default?”
- “Did a push create a new remote branch?”
- “Is Issues enabled for this repository?”
- “Why can I read a public repository but not push?”
A strong answer names both the state and the trust boundary—for
example, “use
gh repo view --json viewerPermission because
authorization is GitHub-hosted state, not a local Git property.”
13. Small failure drills
Wrong directory
gh repo view --json nameWithOwner
If you run this outside a repository and do not supply a repository
argument, the CLI may not know which repository you mean. The
correction is not “re-authenticate”; it is to target
OWNER/REPO explicitly or enter the correct clone.
Wrong GitHub host
If you work with GHES,
gh auth status --hostname github.com checks the public
GitHub.com host, not your employer's server. Host identity is part
of the target. Use the actual enterprise hostname and matching
documentation.
14. Verification checklist
- The lab repository is disposable and contains no sensitive data.
-
You know its exact
OWNER/REPO, visibility, and default branch. - You inspected authentication without printing a token.
-
You captured structured
gh repo viewoutput rather than parsing decorative output. - You used an explicitly versioned REST request.
-
You can explain what the
platform-mappush changed and what it did not change. -
The local and hosted commit ID for
platform-mapmatch.
Knowledge check
Why does this lesson read the default branch instead of assuming main?
After pushing platform-map, which GitHub state definitely changed?
Why prefer gh repo view --json to parsing the normal terminal display?
What does viewerPermission tell you that git remote -v cannot?
A command cannot infer the repository from your current directory. What is the least destructive correction?
15. Summary
You created a free-compatible disposable repository and observed one resource through four views: web UI, GitHub CLI, REST API, and local Git. The key operating habit is now concrete: inspect resource identity, default branch, visibility, permission, and refs before changing anything; then verify mutations through an independent view.
Authoritative references
Types of GitHub accounts
Access permissions on GitHub
About repositories
About versions of GitHub Docs
GitHub CLI manual
GitHub REST API versions
gh auth status
gh repo create
gh repo clone
gh repo view
gh api
REST API endpoint: Get a repository
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.