Updated April 15, 2023
Definition of GitHub Repository
GitHub repository is defined as a location in the GitHub platform where the files and codes corresponding to the projects and their respective versions as a part of revision history is stored, managed, and used. One can discuss and manage the entire project’s work inside the repository itself. The repository acts as a platform where one can perform collaborative work amongst the team members and even across cross-functional teams. Repository is also seen to be used for collection of user feedback, software bug reporting, tasks organization. Another interesting feature that is used by GitHub repository is asked and answer questions within the repository and even make announcements about the project. In this article, we will look at the different elements in GitHub repository in depth!
What is GitHub repository?
Owning a repository can be at an individual level and even be at a level of sharing the ownership amongst other people in the organization. One can also restrict access to the repository in GitHub by changing the repository’s visibility. Even with the free version of GitHub, one can work with multiple repositories and unlimited collaborators with a feature set that is full. Even with private repositories, one can work in GitHub but only with the restricted feature set.
Creating a new repository
Now that we are well versed with the concept of GitHub repository, in this section we will discuss the process of creation of a new repository in GitHub. The repository can be created in not only a personal account but also in an organizational account provided that there are sufficient permissions for the individual to make a repository. While creating a repository the owner can choose to restrict the permissions for the repository within the organization so that one takes into account the intuition behind the data protection in the organization. In this section, we will look at the step-by-step way of creating a repository in GitHub through a web interface, but one can also use the GitHub command-line interface to create the repository. One can dive into gh repo create command to understand this further.
- Step 1: Open the website https://github.com/ and log in to the account.
- Step 2: Look at the top right corner for a + sign and click on that to expand the list and then click on New Repository.
- Step 3: In case there is an existing repository and we need to create a repository with a similar directory structure, we can choose a template from the drop-down menu. This will be only visible if there is a repository template already present owned by the individual or the organization to be used which can be bootstrapped to the new repository.
- Step 4: If a template is selected, optionally one can also select the options like including files from all the other branches as a part of inclusion from the template and not just the default template by selecting the option “Include all branches”.
- Step 5: Next step is to select the owner as per the ownership requirement from the drop-down. There might be multiple owner names present in case the account has the permissions for the same.
- Step 6: Under the Repository name we need to put the name of the repository and make sure that the name somehow explains what that code contains. There is a placeholder for putting in the description of the repository though it is an optional topic.
- Step 7: Next step would be to choose the visibility of the repository. The 3 options available (subjected to the type of account) are Public, Internal and Private. In the below snip, the internal option is not present as the account is personal and not organizational.
- Step 8: Next select the appropriate options like Add a README, Add .gitignore, Choose a license in accordance to what one needs to do in the repository.
- Step 9: Final step to click on Create repository to finish the creation of the repository.
List GitHub repository
Now that we are clear on how a new repository is created, we would now look at how to list down the repositories that are owned by the user or the organization. There are 2 ways that can be achieved:
2. Using the command line interface: Execute the command gh repo list [<owner>] [flags] in the command line to get the list of the repositories for the owner argument that is passed and matching the corresponding flags.
3. Web UI: In the web UI, https://github.com/ on the left-hand panel, we would also be able to see the list of repositories.
Parameters GitHub repository
While using the GitHub API, there are various parameters that can be used to cover specific use cases. Some of the important ones are:
1. types: This is to specify the types of repositories that need to be returned.
2. sort: There are options viz. created, pushed, updates, full_name using which the list can be sorted.
3. direction: This option allows the ascending or descending order of sorting.
4. Per_page: This option allows sending input to restrict the number of inputs per page.
Repository’s settings and features GitHub
Settings in the repository can be moulded in order to customize the repository to the needs of the structure. One can license a repository, display the sponsor button (if any), enable social media preview, topic classification as so on. With customization, GitHub also allows features to be enabled configured, or disabled. Some features are listed below:
1. Issues Disabling
2. Disable project boards in the repository
3. Manage actions for the repository in GitHub settings
4. Enable or disable repository discussions
5. Security and analysis settings management for the repository
Working with files GitHub repository
In the GitHub repository, working with files includes 3 actions namely:
1. Managing Files: All actions like adding, moving to edit, renaming, deleting a file resides in this use case.
2. Using Files: This includes navigating code in GitHub, changes tracking in the file, generating permanent links to the file, working on non-code files.
3. Management of large files: This action takes care of all processes that are required for managing large files in GitHub.
Repository in GitHub is a centralized location in the distributed version control platform, GitHub, for enabling users to collaborate and adapt the culture of open source projects and emphasize forking code, sharing ideas, and so on.
This is a guide to GitHub Repository. Here we discuss the definition, What is GitHub repository is, examples with code implementation. You may also have a look at the following articles to learn more –