Skip to content

Domain 2: Working with GitHub Repositories (8%) โ€‹

โ† Domain 1 ยท Domain 3 โ†’


Creating and Managing Repositories โ€‹

Creating a Repository โ€‹

A repository can be created from:

  • GitHub.com โ€” New repository button, with options for visibility, README, .gitignore, and license
  • GitHub CLI โ€” gh repo create
  • GitHub Desktop โ€” GUI wizard
  • Template repository โ€” instantiate from an existing template

Key options when creating a repo:

OptionWhat it does
Initialize with READMECreates a README.md on the default branch automatically
Add .gitignorePre-fills a .gitignore template for your language/framework
Choose a licenseAdds a LICENSE file to define usage rights
VisibilityPublic / Private / Internal

Cloning vs Forking โ€‹

ActionWhat it doesWhen to use
CloneDownloads the repo to your machine; you push to the same originYou have write access
ForkCreates your own copy of someone else's repo on GitHubContributing to repos you don't own

Exam Tip

Fork โ†’ clone โ†’ PR is the standard open source contribution flow. Fork creates a copy on GitHub; clone downloads it locally; you submit changes via pull request back to the original.


Essential Repository Files โ€‹

README.md โ€‹

The README is the front page of your repository. GitHub renders it automatically on the repo homepage. Best practices:

  • Project description and purpose
  • Installation instructions
  • Usage examples
  • Contributing guidelines
  • License information

LICENSE โ€‹

Without a license, code is "All Rights Reserved" by default โ€” others legally cannot use, copy, or distribute it. Common licenses:

LicensePermissionsRequirements
MITUse, copy, modify, distributeKeep copyright notice
Apache 2.0Use, copy, modify, distributeKeep copyright + patent notice
GPL v3Use, copy, modify, distributeDerivative works must also be GPL
Creative CommonsVariesFor creative work, not code

GitHub Tip

GitHub's license picker is available when creating a repo. You can also add a LICENSE file at any time and GitHub will recognize and display it.

.gitignore โ€‹

Tells Git which files and directories to ignore (not track). Common patterns:

ini
# Dependencies
node_modules/
vendor/

# Build output
dist/
*.class

# Environment files
.env
.env.local

# OS files
.DS_Store
Thumbs.db

GitHub provides .gitignore templates for popular languages and frameworks when creating a repo.

CODEOWNERS โ€‹

The CODEOWNERS file (in root, docs/, or .github/) automatically assigns reviewers to pull requests based on file patterns:

# Global owner
* @org/team-leads

# Frontend files
*.js @org/frontend-team

# Docs
docs/ @org/technical-writers

Exam Note

CODEOWNERS can be placed in three locations: repo root, docs/, or .github/. Only the first matching CODEOWNERS file is used. Code owners are automatically requested for review when files they own are changed in a PR.


Releases and Tags โ€‹

Tags โ€‹

A tag marks a specific commit in history โ€” typically used to mark release versions. Two types:

TypeDescription
Lightweight tagA pointer to a commit (like a branch, but doesn't move)
Annotated tagStores metadata: tagger, date, message. Recommended for releases.
bash
git tag v1.0.0                        # lightweight
git tag -a v1.0.0 -m "First release"  # annotated
git push origin v1.0.0                # push specific tag
git push origin --tags                # push all tags

Releases โ€‹

A GitHub Release is built on top of a tag and adds:

  • Release title and description (supports Markdown)
  • Attached binary assets (downloads)
  • "Latest release" badge
  • Auto-generated release notes from merged PRs

Exam Tip

Tags exist in Git. Releases exist in GitHub. You can create a Release from an existing tag, or GitHub creates the tag when you publish a Release.


Template Repositories โ€‹

A template repository lets teams create new repos pre-populated with a standard structure (files, folders, workflows, etc.) โ€” without inheriting the full commit history.

  • Enable via: Repository Settings โ†’ check "Template repository"
  • Users click "Use this template" instead of forking or cloning
  • Common uses: project boilerplates, org standards, documentation sites
FeatureTemplateFork
Gets commit historyโŒ Noโœ… Yes
Linked to originalโŒ Noโœ… Yes (can PR back)
PurposeFresh start with structureContribute or customize

GitHub Pages โ€‹

GitHub Pages hosts static websites directly from a repository (free for public repos):

  • Source can be: main branch root, main/docs/, or a dedicated gh-pages branch
  • URL format: https://username.github.io/repo-name/
  • Supports Jekyll for static site generation
  • Custom domains supported

Domain 2: Repository Management

1 / 6
โ“

What is the difference between cloning and forking a repository?

(Click to reveal)
๐Ÿ’ก
Clone downloads a repo locally; you push back to the same remote. Fork creates your own copy on GitHub, used for contributing to repos you do not own.

โ† Domain 1 ยท Domain 3 โ†’

Happy Studying! ๐Ÿš€ โ€ข Privacy-friendly analytics โ€” no cookies, no personal data
Privacy Policy โ€ข AI Disclaimer โ€ข Report an issue