How to Clone a repository in git in easy step.

How to Clone a repository in git in easy step.


The git clone command is used to copy an existing Git repository from a server to the local machine.


For example, to clone a GitHub project:


cd < path where you would like the clone to create a directory>

1. git clone https://github.com/username/projectname.git

Example :-

C:\Users\HP\Desktop\Learn_git>git clone https://github.com/narendra7770/notepad_minor.git


To clone a BitBucket project:

cd < path where you would like the clone to create a directory>

2. git clonehttps://yourusername@bitbucket.org/username/projectname.git


This creates a directory called projectname on the local machine, containing all the files in the remote Git repository. This includes source files for the project, as well as a .git sub-directory which contains the entire history and configuration for the project.


To specify a different name of the directory, e.g. MyFolder:

3. git clonehttps://github.com/username/projectname.git 


MyFolder Or to clone in the current directory:


4. git clone  https://github.com/username/projectname.git 


Note:

  • When cloning to a specified directory, the directory must be empty or non-existent.
  • You can also use the ssh version of the command:

git clone git@github.com:username/projectname.git


The https version and the ssh version are equivalent. However, some hosting services such as GitHub recommend that you use https rather than ssh.


1. How to install git in your PC. Git Installation step by step easy explation.

2. How to create your first repository, then add and commit files in git step by step.  

3. How to Clone a repository in git. 

4. How to Share a code trough git. 

5. How to Setting your user name and email in git.

6. How to Setting up the upstream remote in git.

7. How to Learn about a command in git.

8. How to Set up SSH for Git. 

Post a Comment

0 Comments