How to create a GitHub repository
The GitHub repository is the central artifact around which all aspects of GitHub-based DevOps revolve.
To master GitHub, you must master the fundamentals of the GitHub repository.
The GitHub repo lifecycle
The GitHub repository goes through a four-phase lifecycle:
- GitHub repository creation
- Repeated GitHub repository cloning
- A possible need to rename the GitHub repository
- A GitHub repository delete
GitHub repository creation steps
To create a GitHub repository, simply click the green New button on the repositories page.
The basic steps required to create a GitHub repository are:
- Specify the name of the GitHub repository
- Include an optional description
- Specify if it will be a public or private GitHub repository
- Choose to optionally add a README file
- Choose to optionally add a .gitignore file
- Optionally add a fair use license
- Click the green Create Repository button to finish the process
The GitHub URL
Once created, the GitHub repository URL can be used by programmers and DevOps professionals to clone the repository. The GitHub URL takes on the following format:
http://<github.com>/<repository-owner>/<repository-name>.git
To use the GitHub URL to clone my personal github-made-easy repository, the command would look as follows:
git clone https://github.com/cameronmcnz/github-made-easy.git
Note that this command will perform a non-bare clone on all branches and save the repository in a subfolder with the same name as the repository. If you want to only git clone a specific branch, or git clone into a directory, you can use optional switches of the git clone command. Furthermore, if the repository has git submodules, then you must take extra steps to init and update the submodules.
How to rename a GitHub repo
From time to time, the situation arises where you must rename a GitHub repo. To do so:
- Log into the GitHub administrative console
- Click on the repository to rename
- Navigate to the repository’s Settings page
- At the top of the settings page, enter a new GitHub repository name
- Click the Rename button
Delete GitHub repo tutorial
When you’re no longer actively developing your project, you can delete the GitHub repository. To accomplish this:
- Log into the GitHub administrative console
- Click on the repository to delete
- Navigate to the repository’s Settings page
- Scroll down to the Danger Zone section
- Click the Delete this repository option
- Confirm the name of the repository
- Click Delete
And that completes the basic operations associated with the lifecycle of a Git and GitHub repository.