# GitHub - setting up the repository Part 2

In this blog, we will create our new repository in GitHub and perform the basic GitHub commands.

First of all, let's login into GitHub and create a new private repo called **practice** by clicking new in the top left corner of GitHub. It looks like this:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692267792506/bdd75ee1-5009-4a4c-9501-fb14da956eec.png align="center")

You can check all the configurations whether you want to keep your repository private or public.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692268001633/4eaf7dbf-f3ef-4dca-9ff7-92742b2facb2.png align="center")

After clicking the **create repository,** we can see the above page with the given instructions which we can perform in our local terminal or in any code editor like visual studio.

Let's go to our terminal and perform the following.

**Configure User Credential**

```bash
git config --global user.name “[name]” #use your github name
git config --global user.email “[email address]” #use the github email address
```

**git init:**

This command is used to initialize a new repository.

```bash
git init <"path"> #init in the directory where you have placed your codes
```

**Clone the Repository:**

Copy the repository's URL from the GitHub page and Use the `git clone` a command followed by the repository URL.

```bash
git clone <"repository_link">
```

**git add:**

This command adds a file to the staging area.

```bash
git add . # for adding all the current files in the staging area
git add <"file_name"> # for adding only selected files in the repo
```

**git commit:**

This command records or snapshots the file permanently in the version history.

```bash
git commit -m "Initial commit"
```

**git branch:**

The git branch command is used to determine what branch the local repository is on.

```bash
git branch "feature1" # Creates a new branch named feature1
git branch -a # List all remote or local branch names
git branch -d "feature1" # deletes a branch named feature1
```

**git status:**

The status command is used to display the state of the working directory and the staging area.

```bash
git status
```

**git push:**

The command git push is used to transfer the commits or push the content from the local repository to the remote repository.

```bash
git push -u origin <"branch_name">
```

**git pull:**

The git pull command is used to fetch and merge changes from the remote repository to the local repository.

```bash
git pull <"branch_name"> <"repo_url">
```

Apart from these, you may face some problems while authenticating with GitHub due to which you cannot push your code into GitHub.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692330235062/779f40c2-2261-4380-827c-13ac5f5688cb.png align="center")

This is one issue that I faced while I tried to push into GitHub. For this, you can do the following steps:

1. Generate ssh key  
    command: **ssh-keygen -t rsa** (generate an RSA SSH key pair)
    
2. copy the public key from the *~/.ssh/id\_rsa.pub. T*his is the location where the public key is placed.
    
3. Paste on the GitHub SSH and GPG keys section. You can find this section by clicking on the profile then on settings and after that on the left side, you can see the SSH and GPG keys section. Click on the New SSH key and paste the key value you copied from *~/.ssh/id\_rsa.pub.*
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692331526595/92132a4c-817a-42b3-b131-e41c79dfdbe4.png align="center")
    
    Finally, after setting the ssh keys we can push our code into GitHub. We can see the following output when the code is pushed to GitHub successfully.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692331693612/3de13826-fafd-4b77-ac68-c45078103362.png align="center")
    
    Therefore, we can conclude that we created the repository in GitHub and update the repository locally and pushed it into GitHub successfully.
    
    Happy Learning !!
