Creating repositories in git is very simple. In this blog, I will guide you to create repositories in the git hub from scratch and also how to set up an ssh key that can help you to have the best interaction with your git repository.
First, we will start with creating repo’s followed by ssh key set-up.
Creating repositories in GIT:
We have two modes of repo’s in git, one is public and the other is private. Public repos can have access to anyone in the world so that any other people can clone your repo and can download all your code but public repos are limited to your team only.
Here is the step-by-step procedure of creating public and private repo’s.
Creating public repo:
Go to your git account and select the new button at the left corner as shown below.
After selecting the new button, you will navigate to the new repository details page as shown below.
You can see all the required details in the above screenshot are
- Give your repository name
- Select the type of repository, here I’m choosing private
- Add readme file to communicate the important details of your project or summary of your project
- If you want to keep some files untracked then add gitignore file and configure it
- In the end, mention the licence state
These steps are enough to create a public repository, after completion of all these steps you will navigate to the repository and related folders as shown below.Now let us move to create a private repository and how to add your team members to the related project repo.
Creating private repo:
As previous, go to your git account and select new at the left corner so that you will be navigated to the repository details page follow the same steps and select private instead of public as shown below.Then you will navigate to the repository as shown below.Now as it is a private repository, you should add the team members who are going to work on this current project. For that follow the steps given below.
Go to settings and select manage accessSelect add people
Give the collaborator email
Give the project team email address and select add collaborator.After this, an invitation has been sent to the person’s email and he has to accept the invitation and can work on the project. So that he can add files and can do commit to their work.In the above screenshot, you can see the status message as a person is added to the project and in the people section, you can see that pending invite, if the opposite person accept the invitation then the status message will be updated
So you can add as many people as you want by clicking add people button in the right corner. That’s all with these 3 steps you can add your teammates to the repo and enable the required permissions.
So finally we are done with creating repos and how to add a team to it, now let’s move to the next part in the session is setting up ssh key.
Ssh-key set-up
Initially, you have to generate the ssh key and you can do it with the following command
ssh-keygen
As mine is already available, I’m skipping this action. You guys can press enter for the next steps. After completing all the steps an ssh key will be generated and will be saved in the home directory.Now read the id_rsa.pub file, and copy the generated ssh key to know how to read file check out the below blog https://mycode.blog/navya/crud-operations-file-ubuntu-using-terminal
Go to settings
Open your GitHub profile and go to settings.
Open SSH and GPS keys
Select add new key
At the right corner, you can see add new key button, select that. After that, you will be navigated to ssh key details screen as shown below.
Now add your private ssh key that has been generated in the initial step and add key.
Then select add key button. With this, we are done with adding ssh key to your local. Now clone your repository in your local and you can start your work. To know how to clone your repository and all the git operations check out the below blog https://mycode.blog/navya/top-10-basic-git-commands-every-developer-should-learn
Finally, I want to conclude that, in this blog, we have seen how to create repositories and add ssh keys. So guys go and get experiment in your local. Please let me know if I missed anything! Meet you in the comment section.
Comments