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.
- 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
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 "firstname.lastname@example.org"
$ ssh-add ~/.ssh/id_rsa
Key for Linux & Windows:
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.
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/
Repository Created: I have some files in it. Copy SSH link so that we clone the repo.
git clone email@example.com:shobhit-singh/test-dev-repo.git
After doing some changes in any file you can check the status of git.
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
Checking object in git-hub:
git clone firstname.lastname@example.org: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
Happy Learning! Your feedback would be appreciated!Follow @shobhitsinghIN