Getting started with your first GitHub repository
Tags: git, github, repository
Published: 2020-04-28 09:33:26

GitHub is a web platform that hosts Git repositories. Repositories contain all project files, code history, and can have multiple collaborators.

Okay now let's get started!

1)Create a GitHub account

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/8uoqo9xesd2tv476jxyi.PNG)
You need to log in to the main GitHub page and fill out the registration form to build your account.

2)Git installation

You will need to install Git tools on your device.

First, download the latest [git for windows](https://gitforwindows.org/).

Then open your terminal, git bash or powershell and run the command below.
```
$ git --version
```
You will need to run the following commands with your information in your terminal to set a default username and email when saving your work.
```
$ git config --global user.name "Sewvandi Wickramasinghe"
$ git config --global user.email "example@mail.com"
```
Now return to the main GitHub page and click "+" icon.
Once you click on the "+" icon a new menu will appear as given below.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/058in31dwi81ft4gz2pz.PNG)

Click on ***New repository***

Once you click on New Repository, the repository creation page will appear.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/icb07fxl0ss0rby87wtf.PNG)

Give a meaningful name to your first repository and make it public, so anyone could see it.

You can see all your repositories by click on your profile picture in the menu bar.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/9276snt51p3vst2615jm.PNG)

3)Clone the repository

To clone your repository you need to get the “HTTPS” address on the repository page.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/jqkubph7ab78zvmwz2r4.PNG)

After that you need to use your git bash or terminal to move in the place where you want to put the directory copy.

When you are ready, you can enter the following code.

```
$ git clone [HTTPS]
```
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/4ip1ikj4zx836l1xr2p1.png)

4)Edit your repository

Now you can simply create a file named “README.md” in your folder.
After you make a change in README.md file you need to save it. This is called committing.

To do this, get back to your terminal. If you have closed it, go back in your folder.

First you need check the files that you have modified.

```
$ git status
```
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/g6ch8uam9a0j9xh5os72.png)

After that you should add your changes to save this file.
***(add . => add all in the current directory)***

```
$ git add .
```
Once you added the files, you need to write a message to explain what you have done using the following code.

```
$ git commit -m "Added README.md file."
```
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/d6mh4kixleox0ylvn5j7.PNG)

You're almost there! If you type the following command, all your work will be put directly on the repository page and will be visible online.
```
$git push -u origin master
```
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/cysauba1hvmpnu8q6zim.PNG)

You did it! Now you can view your repository on your GitHub repository page.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/gv81ahjlcwtrmd808aik.PNG)

Here's mine,

{% github Sewvandiii/First-Repository %}

What is your opinion here? Share your thoughts in the comments :)