DEV Community

Cover image for Getting started with your first GitHub repository
Sewvandi Promodya Wickramasinghe
Sewvandi Promodya Wickramasinghe

Posted on • Updated on

Getting started with your first GitHub repository

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
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.

Then open your terminal, git bash or powershell and run the command below.

$ git --version
Enter fullscreen mode Exit fullscreen mode

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"
Enter fullscreen mode Exit fullscreen mode

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

Click on New repository

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

Alt Text

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

3)Clone the repository

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

Alt Text

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]
Enter fullscreen mode Exit fullscreen mode

Alt Text

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
Enter fullscreen mode Exit fullscreen mode

Alt Text

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

$ git add .
Enter fullscreen mode Exit fullscreen mode

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."
Enter fullscreen mode Exit fullscreen mode

Alt Text

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
Enter fullscreen mode Exit fullscreen mode

Alt Text

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

Alt Text

Here's mine,

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

Top comments (0)