Pushing repositories on GIT worrying you ?

Worry less Practice more!

Connecting your local machine to GIT will always be the primary stride.

Connecting local machine to the GIT account using SSH key

You will be needing a software called "GITBASH" in order to connect to you GIT account.

A GIT account is also a requisite in order to work with GIT.

After Opening the GITBASH the first and foremost thing to do is to generate the ssh key

Wondering what is a SSH Key? Well , SSH key is used to carry out authentication process between machines.
Hit the following command to generate your ssh key.

$ ssh-keygen -t rsa -b 4096 -C "Your EmailID"

You will find a result on the successful execution of your command.

Press Enter when asked for location to save file, this implies it to take the default location. After Hitting Enter it will ask you for passphrase, passphrase can be any word or set of words that strengthens the security. You can leave it blank else you can enter something you would always remember. The following is the image of the key generated by your command.

Make sure that your ssh agent is running by hitting the following command.
$ eval $(ssh-agent -s)

On successful execution of the command, you will get the “Agent pid” along with the ID of your key. Now execute your ssh keys. For activating the ssh hit the following command.
$ ssh-add ~/.ssh/id_rsa

The above code will add your private key to the ssh agent.

Now what about the public key, what is its role?
Well, it goes into your GITHUB account and connects your local machine to your GITHUB account.
Let’s checkout how to do that.

Primarily you have to copy your public key by hitting the following command
$ clip < ~/.ssh/id_rsa.pub

After which you have to go to your GITHUB account, click on your “profile icon”, go to “settings”, Under “personal settings” go to “SSH and GPG keys”, click on “New SSH key”, Give an appropriate title(“Xen” in my case) and finally paste (CTRL + V) your copied public key in the block provided for public key.

After hitting the “Add SSH key” button, GIT might ask you to provide your GIT password again, later it would add the key and display it like the following.

Creating a repository to do the further operations

To create a new repository, click on the “+” button on the top right corner.

Fill out all the necessary blocks including name(XenWeb), and initializes like Readme.

Now since we’ve created the repository, let’s go back to the GitBash and start pushing files from the Local Machine.

Go to the local Repository/folder that needs to be pushed to the repository, Open GitBash in the same folder by right clicking.

Let us Initialize GIT through the GitBash, using the following Command.
$ git init

To add all the files, Hit the following command
$ git add

If there is any Git folder which is abandoning you to add your files, then you can use the following command.
$ git push origin master

In this way, you can add all your files to your GIT repositories using GIT BASH.

Want to know about internship and training programme ?
Just Subscribe here.

Will help out in learning all the DevOps and DevSecOps tool and you will get an hands-on experience as well.
Grab the opportunity and join us !

Thanks for joining our newsletter.
Oops! Something went wrong.