Creating repositories in Git

Creating repositories in Git

Creating repositories in Git

There are two ways for creating repositories one is cloning, this will be our ending topic .other is by using git commands.repository is the path where we work on our versions. To create a repository we use a git init command to initiate the empty Git repository and creates a .git file in the path .git file has configurations like tags, objects, template files .by this command the new repo will be our master branch and HEAD of the master branch is also created.

To see the present working directory

pwd

Create your project directory

mkdir myproject

Go into the project directory

cd myproject

Git init command (creating repo)

git init
Initialized empty Git repository in /.git/

HEAD: The head is referred to as the last commit in the current checkout branch. for understanding, we can call head as a mouse cursor to select a branch and to work on that branch.

after initializing the git repository user can work on the files like adding deleting or modifying files and pushing to remote repositories like GitHub

Adding files into git repo (staging area)

user can able to add any file to the git repository

git add <file_name>

To add every file inside the folder, use below command ,space should be there before dot (.)

git add .
Last updated on by vishal devxo