Understanding the Basics: How to Create a Local Git Repository



We'll go over how to set up a git local repository after installing git-bash or Git on your laptop or desktop in this tutorial. 

If you're new to Git and need help installing it, Go Here.  It will redirect you to the video tutorial, where you may follow the onscreen instructions.

OR checkout this video Guide:



Note:
This article is only applicable to Linux or Unix environments.

Now let's see how to setup?

1. After installing Git-bash, run the following commands to configure user details at once.
  • git config --global user.name "chandrasekhar"  
  • git config --global user.email "csrk@gmail.com"

2. User details have been successfully configured in Git, and you can verify and edit them using the instructions below by launching gitbash.
  • git config --list (aall configurations will be displayed).
  • git config --global --list (only user name and user email will display)
  • git config --global --edit (for editing the user details).

3. If you only want to see the user name and email address, use the gitbash instructions below.
  • git config user.name
  • git config user.email

4. What is the next step? Make a Git local repository on your laptop or desktop computer.
  • First, create a directory named git-practise and navigate to it.
  • $ mkdir git-practise
  • $ cd git-practise

5. Create a local Git empty repository with the following command:
  • $ git init
 
Initiated a new Git repository in C:/Users/crklive/Desktop/git/myrepo/git-practice/.git/.
 
We have now successfully initialised the git local empty repository, and you can use the following command to check the status of the untracked files.
 
$ git status
 
On branch master
No commits yet.
nothing to commit (create or copy files and use "git add" to track).
 

Conclusion

 
In this tutorial, we learnt how to set up user details as well as a git local repository on your laptop or desktop computer. Follow my YouTube channel and experiment on your own if you want to do some R&D.
 

Chandra Sekhar

A Blogger and Author! This post was written and edited by me, a technologist. I started this site to share my inspirations, work, and free materials, which I hope others may find useful as well. Man with a creative streak who enjoys experimenting with various web design strategies.

Previous Post Next Post

Microservice Communication in a Distributed System