This write-up will talk about the method of cloning the remote repository into an existing folder.
How to Perform “git clone” Into an Existing Folder?
To clone a Git remote repository in the existing folder, try out the following instructions:
- Navigate to the required Git repository
- Check repository content.
- Copy the remote repository URL.
- Use the “$ git clone <remote-url> <desired-folder>” command.
Let’s implement the above-stated instructions!
Step 1: Move to Git Repository
Go to the Git repository by providing its path with the “cd” command:
Step 2: List Content of Current Repository
Then, execute the “ls” command to list the content of the current repository:
Step 3: Move to Existing Folder
Navigate to the existing folder through the “cd” command along with the folder name:
After that, view the content of navigated folder using the “ls” command:
According to the below-given output, the folder is empty:
Step 4: Copy Remote Repository URL
Next, go to the particular remote repository and copy its HTTPS URL:
Step 5: Clone Repository in Existing Folder
Next, execute the “git clone” command along with the desired existing folder on which you want to clone the remote repository:
Here, the folder name is placed at the end of the remote repository URL:
Step 6: Move to Particular Folder
Next, move to the folder in which the remote repository is cloned:
Lastly, run the “ls” command:
The below-highlighted output indicates that the remote repository is cloned successfully in the specified existing folder:
We have compiled the method of cloning the remote repository into an existing folder.
Conclusion
To clone a Git remote repository in the existing folder, move to the required Git repository and view its content. Then, copy the remote repository URL and execute the “$ git clone <remote-url> <desired-folder>” command, and verify the cloned repository. This write-up described the procedure of cloning the remote repository into an existing folder.