Getting started with Github – A beginner’s guide

Github is one of the most widely used code repository storage system. It is helpful in storing content on a cloud network and manage it via Git. Moreover, you can also fork some other repository for your own usage, provided it is publicly available and license of that repository defines to what extent you can modify and use the forked codebase. To begin with, Github offers both private and public repositories. As a free user, you are allowed to have only public repositories. More details about the pricing can be found here.

In this post, we are going to create a new repository using Github’s graphical interface and then clone it onto our system. After that, we will put some code locally and then push it to the online repository that we created.

Prerequisite – github account

Creating a repository

  • Login to your github account and look for a New repository button in the right side of homepage.

GitHub

  • In next step, give a name to your repository. We are using here name – ‘PyJournal’
  • Initialize the repository with a Readme so that we can let people what is the purpose of this respository.
  • Select visibility as public and click on Create repository

Cloning the repository

  • To interact with our newly created repository, we need git to be installed in our local system. Download git depending upon type of your operating system.
  • After download and installation is successful, open git bash from start menu. A console will be opened.
  • In your console, navigate to the place where you want to store your repository locally.
  • To clone your repository, give command – git clone https://github.com/<your github usernmame>/<repository name>.git
  • If it prompts you for username and password for accessing your github account.
  • After cloning is successful, you will see a contents of your remote repository created earlier available locally.

Modifying the remote repository

  • Since we selected to create a readme file during repository creation, an empty readme file will be available in your local system.
  • Open readme using any text editor and put some information about your repository, save and close it.
  • After that go to git bash at the root of your repository.
  • type
    git add README.md
  •  Now readme file is staged to be committed to your local repository.
  • To commit, type
    git commit -m 'updated readme'
  • Now changes are committed in your local system. You need to push this changes to remote master branch of your repository. Type
    git push origin master
  • If prompted for account credentials, provide it.

If everything goes fine, your changes will be successfully committed and pushed to the github remote repository. You can verify the same by going to your github repository and look for the changed readme file.

For feedback or any difficulty in doing above process, please comment in the comments section below.

The post Getting started with Github – A beginner’s guide appeared first on PyJournal.