Table of Contents
What is a Repository?
How to create a repository
Adding files to a repository
How to fork a repository
Excercise
What is a Repository?
A repository contains all of your project's files, revision history, and collaborator discussion. You can use repositories to manage your work, track changes, store revision history and work with others. Before we dive too deep, let’s first start with how to create a repository.
How to create a repository
You can create a new repository on your personal account or any organization where you have sufficient permissions.
Let’s tackle creating a repository from github.com.
- In the upper-right corner of any page, use the drop-down menu, and select New repository.
- Use the Owner dropdown menu to select the account you want to own the repository.
- Type a name for your repository, and an optional description.
- Add Description to the repository (optional)
- Choose a repository visibility.
- Public repositories are accessible to everyone on the internet.
- Private repositories are only accessible to you, people you explicitly share access with, and, for organization repositories, certain organization members.
- Enable Add a README file
- Click Create repository and congratulations! You just created a repository!
Next up, let’s review how to add files to your repository.
Adding files to a repository
Files in GitHub can do a handful of things, but the main purpose of files is to store data and information about your project.
Let’s review how to add a file to your repository.
But before we begin, it is worth knowing in order to add a file to a repository you must first have minimum Write access within the repository you want to add a file.
- On GitHub.com, navigate to the main page of the repository.
- In your repository, browse to the folder where you want to create a file.
- Above the list of files, select the Add file ᐁ dropdown menu, then click ᐩ Create new file.
- In the file name field, type the name and extension for the file. To create subdirectories, type the / directory separator.
- In the file contents text box, type content for the file.
- To review the new content, above the file contents, click Preview.
- Click Commit changes...
- In the "Commit message" field, type a short, meaningful commit message that describes the change you made to the file. You may provide Extended description to the commit.
- You can attribute the commit to more than one author in the commit message.
- If you have more than one email address associated with your account on GitHub.com, click the email address drop-down menu and select the email address to use as the Git author email address. Only verified email addresses appear in this drop-down menu. If you enabled email address privacy, then [username]@users.noreply.github.com is the default commit author email address.
- Below the Extended description field, decide whether to add your commit to the current branch or to a new branch. If your current branch is the default branch, you should choose to create a new branch for your commit and then create a pull request.
- Click Commit changes or Propose changes.
Congratulations you just created a new file in your repository! You have also created a new branch and made a commit!
Uploading files
- On GitHub.com, navigate to the main page of the repository.
- In your repository, browse to the folder where you want to create a file.
- Above the list of files, select the Add file ᐁ dropdown menu, then click ᐩ Upload files.
- Upload files either by using drag and drop or select using Choose your files feature.
- In the Commit Changes tab,
- In the "Commit message" field, type a short, meaningful commit message that describes the change you made to the file. You may provide Extended description to the commit.
- Below the Extended description field, decide whether to add your commit to the current branch or to a new branch. If your current branch is the default branch, you should choose to create a new branch for your commit and then create a pull request.
- Click Commit changes or Propose changes.
Congratulations you just created a new file in your repository! You have also created a new branch and made a commit!
We will discuss about pull request in coming posts.
How to fork a repository
Demonstrated repository
- Navigate to the Repository which we need to fork
- In the Header part of the repository select fork option
- Modify the fields only if necessary for better understandability.(Here we are not modifying any fields)
- Here we are having an option called Copy the main branch only
- This refers to copy only the main branch and then contribute back to the original Repository.
- Click on Create fork
Congratulations you just created a Copy of repository!.
Excercise
Follow the instructions in the repository's README file to understand how the exercise works, its learning objectives, and how to successfully complete the exercise.
-
Note:
- You don't need to modify any of the workflow files to complete this exercise. Altering the contents in this workflow can break the exercise's ability to validate your actions, provide feedback, or grade the results.
- Refresh page after 20 seconds when a step completed.
Top comments (0)