In this blog we will explore the basics of git repository. Git – Open source version control system for tracking changes in source code during software development. I have used github.com/ to create a repository for objects versioning. We will explore below topics in this blog. 

  • Installation of git in the Linux, Windows OS & configuration.
  • Generating ssh key for authentication git-hub account.
  • Clone the existing git-hub repository in local environment.
  • Pushing changes from local cloned repository to remote repository.

Install git:

  • To install the git in Linux: sudo apt-get install git
  • For Windows you can download it from : git-scm.com Check the version after installation

check

Below configuration required.

git config –global user.name “<<username>>”
git config –global user.email “<<email>>”

Generation SSH keys:

You can setup the ssh keys so that very time you don’t have to provide username & password for git repository while pushing changes. Refer this blog for more details help.github.com

Below command create the public & private ssh keys for your system.

$ ssh-keygen -t rsa -b 4096 -C “your_email@example.com”

$ ssh-add ~/.ssh/id_rsa

Key for Linux & Windows:

linux

win

The public key present in id_rsa.pub file you need to copy that & set in your git-hub settings. You can have multiple keys in git-hub account.

keys

Cloning existing git-hub repository:

You can clone the remote repository in your local environment. After that you can make changes & later push to remote location.

Created a repository using the github.com/

repocrete

Repository Created: I have some files in it. Copy SSH link so that we clone the repo.

test

git clone git@github.com:shobhit-singh/test-dev-repo.git

clone
After doing some changes in any file you can check the status of git.

git status

status

Pushing local changes to remote repository:

To push the changes from local to remote repository.

git add . --all
git commit -m 'insert comments here'
git push

git push

Checking object in git-hub:

git

Commands:

git clone git@github.com:shobhit-singh/test-dev-repo.git
git status
git add . --all
git commit -m 'insert comments here'
git push

For creating new repository from command line refer this blog: GitHub Repository Creation – Command Line


Thanks!

Happy Learning! Your feedback would be appreciated!

One thought on “GitHub Repository – Configuring/Cloning

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s