Key files

Files with fixed names tell GitHub how the project works

README.mdLICENSECONTRIBUTING.mdCODE_OF_CONDUCT.mdSECURITY.md.github/CODEOWNERS.gitignoreshown on the front page of the repositorywhat other people may do with the codehow to contribute; linked when someone opens an issue or pull requesthow people are expected to behavehow to report a vulnerability privatelywho is asked to review changes, path by pathwhat Git should leave untrackedA handful of files with fixed names tell GitHub, and visitors, how the project works.GitHub recognises each by its name and acts on it: it shows the README, displays the licence,links the contributing guide, and requests reviews from code owners.

README, LICENSE, CONTRIBUTING, SECURITY and CODEOWNERS.

Key files · Going deeper

What GitHub does with each file

FileWhat GitHub does with itREADMERenders it on the repository's main page; the first thing a visitor readsLICENSEShows the licence in the sidebar; without one, default copyright appliesCONTRIBUTINGLinks it when someone opens an issue or a pull requestCODE_OF_CONDUCTLists it in the community profileSECURITYShows it under the Security tab as the security policyCODEOWNERSRequests a review from the owners of each changed pathIssue and PR templatesPre-fill new issues and pull requests (in .github/)These files may sit in the root, in docs/ or in .github/.An organization can keep default versions in a public repository named .github, and everyrepository without its own copy uses them. Insights shows a Community Standards checklist.

They may live in the root, docs/ or .github/.

Creating repositories

Template, fork and clone copy different things

copies the filescopies the historystays linked to the originalthe copy livesFrom a templatea fresh start from a pattern✓✗✗on GitHubForkyour own copy, to propose changes✓✓✓on GitHubClonea working copy✓✓✓on your machineThree ways to copy a repository, for three different purposes.A template gives you the files with a clean history and no tie to the original: use it to startnew projects alike. A fork keeps the history and the link, so you can send changes back. Aclone is the copy on your own machine that you work in.

A template copies files only. A fork keeps history and a link. A clone is local.

Creating repositories · Going deeper

Creating a repository, and its settings

When you create a repositoryOwnerYour personal account, or an organization you belong toName and descriptionThe name is part of the address: github.com/owner/nameVisibilityPublic, private, or internal (enterprise members only)Add a READMEStarts the repository with one commit, so it can be cloned at onceAdd .gitignoreFrom a list of ready-made templates by languageChoose a licenseFrom common open source licences, such as MIT or Apache 2.0Later, in SettingsTemplate repositoryTick it, and others get a "Use this template" buttonDefault branchThe branch people see first and pull requests target; usually mainThe Danger ZoneRename, transfer, archive or delete: at the bottom of SettingsCreate branches from the branch menu on the Code tab, or with git.

Owner, name, visibility, README, .gitignore and licence.

Check yourself

copies the filescopies the historystays linked to the original✓✗✗

Which way of starting a repository does this row describe?

Managing files

Every edit in the browser is still a commit

In the browsercreate, upload, editor delete a fileCOMMIT CHANGESmessage: Fix a typo in the guideCommit directly to mainCreate a new branch andstart a pull requesta new commit on main,at oncea branch, then a pull request:reviewed before it landsEvery change to a file is a commit, even one made in the browser.You can add, edit, rename and delete files on GitHub without Git on your machine. Saving asksfor a commit message and where to put the commit. On a protected branch, the second choiceis the only one offered.

Editing on GitHub ends in a commit: straight to the branch, or to a new branch and pull request.

Managing files · Going deeper

File operations on GitHub

ToDo thisCreate a fileAdd file, Create new file; type a/b/name to make foldersUpload filesAdd file, Upload files, or drag them in; up to 25 MB each in the browserEdit a fileOpen it and press the pencilRename or moveEdit the file and change its name or pathDeleteOpen it, then the menu, Delete file; the history keeps the old versionsSee who changed a lineBlame viewSee all versionsHistory, on the file or the folderLink to an exact versionA permalink (press y), which pins the commitGit warns about files over 50 MB and GitHub refuses files over 100 MB.Large files such as videos and datasets belong in Git Large File Storage (Git LFS).

Blame, history, permalinks, and Git LFS for large files.

Insights

Insights describes a repository without its code

PULSE12pull requests merged5issues closedwhat happened latelyCONTRIBUTORSana42raj17li6who commits, and how muchTRAFFICviews per day, 14 daysvisitors, clones, referrersDEPENDENCY GRAPHthis repolibrary Alibrary Bwhat the code relies onThe Insights tab answers questions about a repository without reading its code.Pulse summarises recent activity. Contributors shows who commits. Traffic shows views, clones andwhere visitors came from, for the last 14 days. The dependency graph lists the packages the codeuses, and is what Dependabot alerts are built on.

Pulse, Contributors, Traffic and the dependency graph.

Insights · Going deeper

Stars, watching and other signals

Signal or viewWhat it tells youStarA bookmark for you, and a public sign that people value the repositoryWatchYou receive notifications for the repository's activityFork countHow many people made their own copy to build on or contribute fromCommunity StandardsWhich recommended files (README, licence and so on) are presentCommits, Code frequencyHow much is changing, week by weekNetwork, ForksThe branches and forks, and how they relateDependency insightsAcross an organization: dependencies, their licences and advisoriesFeature previewTry features that are still in beta, switched on from your profile menuTraffic is visible only to people with push access. Stars and forks are visible to everyone.

Stars bookmark, Watch notifies, feature preview shows betas.

Check yourself

Views1,204 in the last 14 daysVisitors310 uniqueClones45, and the sites that sent people here

Where in Insights are these numbers?

Upkeep

Archive what is finished. Delete what should not exist

Activenormal work✓read and clone✓push commits✓open issues and pull requestsArchivedfinished, kept for reference✓read and clone✗push commits✗open issues and pull requestsDeletedgone✗read and clone✗push commits✗open issues and pull requestsArchive a finished repository. Delete only when it should not exist.An archived repository is read-only, and can be unarchived later. Deleting removes the code,issues and wiki; it can usually be restored within 90 days, and then it is gone.

An archived repository is read-only and can come back. A deleted one is gone.

Upkeep · Going deeper · 1 of 2

Good upkeep

Good upkeepDescribe itA one-line description and topics, so people can find itKeep the README currentWhat it is, how to install it, how to use it, how to contributeProtect the default branchRequire a pull request and passing checks (lesson 8)Keep branches short-livedSwitch on "Automatically delete head branches" after mergingMark releasesA release is a tag plus notes and downloadable filesKeep dependencies freshDependabot opens pull requests for updatesArchive what is finishedIt tells visitors the project is no longer maintainedA repository is maintained for its readers as much as for its authors.

Description, topics, a current README, releases and tidy branches.

Upkeep · Going deeper · 2 of 2

Clue words for repositories

When the question saysThe answer isRemember"shown on the repository's front page"READMEREADME.md"what others may do with the code"LICENSEno licence: all rights reserved"guidelines for people who want to help"CONTRIBUTINGlinked on new issues"automatically request reviewers by path"CODEOWNERSroot, docs/ or .github/"how to report a vulnerability"SECURITYthe security policy"start new projects with the same structure"Template repositoryno shared history"propose changes to someone else's project"Forkstays linked upstream"views, clones and referring sites"Insights: Trafficlast 14 days"summary of recent activity"Insights: Pulse"packages the project depends on"Dependency graphfeeds Dependabot"read-only, no longer maintained"Archived repositorycan be unarchived"store very large files"Git LFSover 100 MB is refusedDomain 2 is 10 to 15% of the exam.

README, CODEOWNERS, template, fork, Traffic and archive.

Check yourself

Projectfinished: no more changes are plannedCodeshould stay visible, so others can read and fork itStopnew pushes, issues and pull requests

What should the maintainer do with the repository?

Lesson complete

You finished “Working with repositories”

Answer the questions along the way to see your score here.

Open in a new tab