Steps For Configuring Git 📥📤 With Details

Introduction

 
In a previous article, I described in detail about Git and GitHub and how they perform the roles of source code management and version controlling system. Also, I described how the developers can utilize the Git and GitHub in their day-to-day real-time work.
 
In this article, I will describe below mentioned points in details.
  1. Steps to configure git on windows.
  2. What are git clone and pull commands and how to use.
  3. What are public and private repositories.
  4. Steps to create public and private repositories and their differences.
Note 
Before going through this session, please visit my below-mentioned session related to Git and GitHub.

Let's Know About Public And Private Repositories

 
So, I need to create a new repository called SecondRepo as mentioned in below image. As per below image the red highlighted marks should be the proper inputs as mentioned by me. 
 
Steps For Configuring Git 📥📤 With Details
 
There are two types of repositories called public repository and private repository as mentioned in the below image.
 
Steps For Configuring Git 📥📤 With Details
 
Public Repository
 
Anyone can see that repository. There is no need to get authorized or authenticated user to this GitHub account but you will not be modify the code. To access or modify code, You have to give that user a proper access in your GitHub account.
 
Private Repository
 
Here you have to choose who has to see and modify the code of this repository. If I choose the private repository then I have to select the users and give them proper access like read and update access.
 
Now you can see the new repository named SecondRepo is created successfully as mentioned in below screenshot.
 
Steps For Configuring Git 📥📤 With Details
 

Let's Know About git clone

 
So in my repository named SecondRepo whatever files are present here I need to take these files to my local repository. For this I need to clone this. To clone this you need to select code tab and there are various ways we can clone with and these are HTTPS, SSH and GitHub CLI as mentioned in below image.
 
Steps For Configuring Git 📥📤 With Details 
 
So as of now I can use clone type called HTTPS and using this URL under HTTPS clone type I can take the files available in SecondRepo repository to my local repository. So, for this I need to install an application called Git to configure this HTTPS URL because that related to Git and GitHub.
 
To get this Git application just type in search bar or Google it for Git for windows. So, you can see a related interface as mentioned below,
 
Steps For Configuring Git 📥📤 With Details 
 
I click here 64-bit Git for Windows Setup as per my system configuration and it will start downloading. I installed on my local machine and make sure Git is installed in my machine or not, to know this you just right click on desktop and you can see the interface with few Git options as below image.
  • Git GUI Here
  • Git Bash Here 
Steps For Configuring Git 📥📤 With Details 
 
That means Git is installed properly in my local machine. Now I need to upload my project files to SecondRepo repository under Add File >> Upload Files as per mentioned below image,
 
Steps For Configuring Git 📥📤 With Details 
 
After then you get an interface as mentioned below and click on choose your files.
 
Steps For Configuring Git 📥📤 With Details 
 
Here I added one DateDetails.cs file and after successful upload the interface is shown as below,
 
Steps For Configuring Git 📥📤 With Details 
 
If you click on the DateDetails.cs file then you can see the entire code in GitHub as below image,
 
Steps For Configuring Git 📥📤 With Details 
 
Next step is to go to Code tab and click on clone type i.e. HTTPS and copy the HTTPS URL as mentioned in below image,
 
Steps For Configuring Git 📥📤 With Details 
 
Next step is, I created one new folder called MyGitRepo in my local machine.  Go to this folder and right click inside this folder and click on Git Bash Here option as mentioned in below image,
 
Steps For Configuring Git 📥📤 With Details 
 
Then you can see an interface of Git as mentioned in below image,
 
Steps For Configuring Git 📥📤 With Details 
 
After then you mention your HTTPS URL with git clone command. Here git clone is the Git command. Our system can't recognize the git clone command by default and thats why I installed Git in my local machine. Check the below image,
 
The command is : git clone https://github.com/satyaCsgithub/SecondRepo.git
 
Steps For Configuring Git 📥📤 With Details 
 
After then my Git started cloning whatever the files in SecondRepo repository to my local machine. Check the below image,
 
Steps For Configuring Git 📥📤 With Details 
 
Also, You can check in local machine there is a new folder created same as the SecondRepo repository name and the files available in that repository are cloned successfully
into my local machine. Check the below image,
 
Steps For Configuring Git 📥📤 With Details 
 
To get the list of files and folders in my local machine using Git command is "ls" as mentioned below. Here ls is the command which gives the list of files and directories.
 
Steps For Configuring Git 📥📤 With Details 
 
To check the details of the file in that SecondRepo folder check below command as mentioned below,
 
Steps For Configuring Git 📥📤 With Details 
 
Git Clone 
 
It is the git command which is used to clone the files for first time from our local machine. 
 
Let's understand in details with scenario
 
Here one developer created one new file under the SecondRepo repository in GitHub and then click on Commit new file button to save the changes. The file name is MyFile1.cs and content of this file as mentioned below,
 
Steps For Configuring Git 📥📤 With Details
 
Here you can see the newly created file as mentioned below,
 
Steps For Configuring Git 📥📤 With Details
 

Let's Know About git pull

 
Now I want to get this new file named MyFile1.cs to my local machine. For this I use git command called git pull. This command will start pulling that new file from the SecondRepo repository to my local machine. Check below image,
 
The command is : git pull 
 
Steps For Configuring Git 📥📤 With Details 
 
If you check the local machine then you can see that new file as mentioned below,
 
Steps For Configuring Git 📥📤 With Details 
 
You can check by command as below image,
 
Steps For Configuring Git 📥📤 With Details 
 
Now I want to print the content of this new file called MyFile1.cs. The command is :  cat MyFile1.cs. Here you can see the same content I have done changes in GitHub account that same content is available now in my local machine.
 
Steps For Configuring Git 📥📤 With Details 
 
let's update the same file with new content by clicking on edit option. Added one line code as highlighted in below image and then click on Commit changes button.
 
Steps For Configuring Git 📥📤 With Details 
 
Now my new file is updated with new changes as mentioned below,
 
Steps For Configuring Git 📥📤 With Details 
 
Now i want to get the latest changes to my local using git pull command and print the latest content using cat MyFile1.cs command as below image,
 
Steps For Configuring Git 📥📤 With Details 
 
In this way, We can get new files and updated files with new changes using git pull command from GitHub repo to Local Git.
 

Difference Between Git Clone And Git Pull

 
Git Clone 
  • It used to get files for first time from GitHub repo to Local Machine
  • It used only once 
Git Pull
  • It is used to get latest changes or files from GitHub repo to local Git
  • It can be used multiple times 
Let's Understand Git Flow Using Diagram
 
Steps For Configuring Git 📥📤 With Details
 
Here GitHub is the account and there are two repositories called FirstRepo and SecondRepo. So, I want to get files from FirstRepo respository to my local git which is available in my local machine. The git is installed in the same machine as i described earlier.  Here for getting code first time I used a command called git clone to get files from remote repository to my local repository. There is a repository called .git is created and this is nothing but a local repository in my local as per below image,
 
Steps For Configuring Git 📥📤 With Details 
 
First time after cloning, This .git folder is in hidden format. To make it visible just make setting as shown in below image,
 
Steps For Configuring Git 📥📤 With Details
 

Understanding Public And Private Repositories In Depth

 
Here I will check my public repository that SecondRepo in other browser without signed in. Here everyone can see those files even without signed in or without any authentication and authorization as shown in below image,
 
Steps For Configuring Git 📥📤 With Details 
 
Here edit link is disabled so that the user can't change without signed in and for this special permission is required  with Signed In as shown in below image,
 
Steps For Configuring Git 📥📤 With Details 
 
Now I want to create a private repository called MyThirdPrivateRepo as shown in below image and let's see what happens,
 
Steps For Configuring Git 📥📤 With Details 
 
After then you can see the interface as shown below,
 
Steps For Configuring Git 📥📤 With Details 
 
Here I will check my private repository that MyThirdPrivateRepo in other browser without signed in. Here you got page not found message.
 
Steps For Configuring Git 📥📤 With Details 
 
If one user called abc also signed in and wants to see the files present in that private repository but the user can't access that private repository. For this the admin of that private repository that means who created that private repository gives the permission to that abc user. Those permissions are for see the repository the admin will give the read permission to the abc user and for update the changes the admin will give write permission to the abc user.
 

SUMMARY

 
In this write-up, we have learned the below details,
  • Steps to configure git on windows.
  • What are git clone and pull commands and how to use.
  • What are public and private repositories.
  • Steps to create public and private repositories and their differences.