Creating a repository using Git and GitHub for Beginners
In this article we shall be diving into creating a repository from scratch using Git and GitHub, As suggested by the title this article is intended for individuals with no idea on how to create a repository. If you have been working with these tools/technologies for awhile you will probably find this trivial. That being said constructive criticism is very much welcome if you notice something I could do better please feel free to ping me and lets discuss, now Ladies & Gentlemen lets learn together!
First things first what is a repository??
Well from my simple understanding a repository is simply a folder where you store items now from the perspective of a software developer its a central location where we keep files(for example HTML, CSS & JavaScript files) on which we have written instructions for the computer to interpret and execute to produce a desired outcome.
Now that we know what we are dealing with lets get the tools we will be using to create our repository.
At this point am going to assume you have a computer with a web browser and you know your way around the world wide web. so you are going to navigate to the website where we shall be getting git from which is https://git-scm.com/ and should look like this
You should be able to identify the downloads section which I have circled in the image above click on downloads. Upon clicking you will be lead to a page with the different operating systems that is Windows, Mac OS & Linux that Git was built to run on.
Please click on the operating system that your computer is running and that should prompt an auto download pop up message with your downloader asking for your consent to download git please accept. If there is no pop up the website will have loaded a new page from which you can manually download git.
One thing of great importance you should note is that you will need to make sure that your installation includes git bash for windows if you are to fully explore git commands using the terminal on Windows for more clarity on this watch the following video to properly complete the install of git on your PC.
The next step is getting a GitHub account , To offer some perspective GitHub is a cloud service that allows to store your repositories remotely using git so you will definitely need a GitHub account if you are going to utilize all the benefits that come from having a remote repository. So you will need to navigate to github.com and sign up the biggest requirement here will be an email address.
Creating a Repository(Repo) finally!!
If you have stuck with me up to this part well Kudos to you because we’re almost home and dry. So I am going to assume at this point you have git installed on your machine and you also have a GitHub account. Now when you sign into your GitHub am going to need you to click on your profile picture which should be in the top right corner and click on “Your Repositories”
After here you should be led to the page showing the repositories you have created in the past but for your case most likely there is no list since this is your first repo, click on the New button which should be on the right side of your computer screen.
From this page you will be led to a new page where you get to give your repo a name and also select some preferences that should be added to your repo you can ignore those for now and focus on writing a proper name for your repository.
After writing your desired name click below on the Create repository button located at the end of the preferences selection.
After clicking on create repository you will be led to a screen that with instructions that will be leading us to the terminal but in our case this will be git bash where we will start using commands to see git flex its muscles.
At this point we will go to our computer and start up the git bash application and from there we shall navigate to a local folder on our computer where we will keep our local copy of the repository we have created to be stored. But before we get to creating and connecting the repositories we have to configure our local git by connecting it to the GitHub account we created. see attached video for steps followed to configure git and don’t forget to use the password and email you used when creating your GitHub account because they are the ones required for this process.
Now that our git credentials have been set up, we can now navigate to the folder/directory of choice or create a folder/directory whose name should match the repository created earlier in GitHub.
The next step is to go back to our git and copy the command for creating a fresh new repository as shown in image below, The copy button is the one circled with the color yellow.
We now head over to our git bash and paste in the commands we have copied and git will run them up to the point of pushing as seen below.
At this point your only left with hitting enter on your keyboard to finalize creating your repository as seen below
And with this you my friend have created your repository and now you can go a head and add files, make edits and push those changes to your remote repository. This is just the beginning there are a few more commands that have not be explored in this article that will be vital to your proper use of git and fortunately there are a lot of sources on the internet where you can get guidance on the different commands available for use in the git bash terminal.
Inconclusion I would like to mention that this article may look like it was geared more towards individuals using the Windows operating system but that is not the case since the commands are the same across all operating systems with Windows being referenced a lot because its the OS that yours truly the author is using. That being said I hope this was a nice read like I said at the beginning I welcome all feedback so feel free to leave some otherwise stay logged In and I will catch you on the next one.✌