


How to Clone GitHub Repository and Duplicate the Repository?
Jun 22, 2025 am 12:26 AMThis article provided by MiniTool guides you through the process of cloning/duplicating a GitHub repository in various ways and scenarios. Study each method carefully and select the one that best fits your needs!
What Is GitHub Clone?
In general, when we mention GitHub clone, we are referring to cloning a GitHub repository. This means making a copy of the GitHub repository.
Why Clone GitHub?
When you create a GitHub repository, it initially exists as a remote repository. However, you can clone your repository to a local area on your computer and synchronize between these two locations.
To facilitate adding/moving files, resolving merge conflicts, and pushing larger commits more easily, it is recommended to clone your repository from the GitHub data center to your local computer.
You can also clone your own existing repository or someone else's existing repository to contribute to a project.
How to Clone a GitHub Repository?
Cloning your repository downloads a complete copy of all the repository data that GitHub has at that moment, including all versions of every file and folder for the project. You can push your changes to the remote repository on GitHub or pull others' changes from GitHub.
How to Clone from GitHub Using the Command-Line?
Let’s dive into the instructions!
Step 1. On GitHub, go to the main page of the repository.
Step 2. Above the files list, click the Code button.
Step 3. There are three options for you to clone a GitHub repository.
- Clone with HTTPS
- Use SSH
- Use GitHub CLI
Select the option you prefer and click the copy icon next to the URL link.
Alt=Clone from GitHub
Step 4. Launch Git Bash.
Step 5. Change the current working directory to your desired destination.
Step 6. Type git clone and paste the link you copied earlier.
$ git clone http://ipnx.cn/link/7fb15019103809d7311d26d2e8bb47ed
Step 7. Press Enter to create your local repository. Then, wait for the cloning process to finish.
Cloning a Repository Using GitHub Desktop
To clone a repository to GitHub Desktop, the steps are similar to using commands. The difference is that after clicking the Code button, you should choose the Open with GitHub Desktop option to open the repository with GitHub Desktop. Then, click Choose and navigate to the local path via Windows Explorer. Finally, click Clone.
How to Clone an Empty Repository?
An empty repository contains no files. It is typically created when you do not initialize the repository with a README when creating it.
The method for cloning an empty repository is similar to cloning a regular repository. You have three options to choose from: Set up in Desktop, HTTPS, and SSH.
How to Duplicate a Repository?
To copy a repository without forking it, you need to run a special clone command and then mirror-push to the new repository.
First, you must create the new repository on GitHub using commands like username/new-repository or username/mirrored.
Mirror a Repository
1. Open Git Bash.
2. Make a bare copy of the repository:
$ git clone –bare http://ipnx.cn/link/726bd18c52afc248015dcdbc463c6f85
3. Mirror-push to the new repository:
$ cd old-repository.git
$ git push –mirror http://ipnx.cn/link/cef347a99ab5be3642ec79a8e2c0bc87
4. Delete the temporary local repository you created:
$ cd ..
$ rm -rf old-repository.git
Mirror a Repository Containing Git Large File Storage Objects
1. Open Git Bash.
2. Make a bare copy of the repository:
$ git clone –bare http://ipnx.cn/link/726bd18c52afc248015dcdbc463c6f85
3. Move to the repository you cloned just now:
$ cd old-repository.git
4. Pull in the repository’s Git Large File Storage objects:
$ git lfs fetch –all
5. Mirror-push to the new repository:
$ git push –mirror http://ipnx.cn/link/cef347a99ab5be3642ec79a8e2c0bc87
6. Push the repository’s Git Large File Storage objects to your mirror:
$ git lfs push –all http://ipnx.cn/link/cef347a99ab5be3642ec79a8e2c0bc87
7. Remove the temporary local repository you created earlier:
$ cd ..
$ rm -rf old-repository.git
Mirror a Repository in Another Location
To mirror a repository in another location as well as get updates from the original, just clone a mirror and periodically push the changes.
1. Start Git Bash.
2. Create a bare mirrored clone of the repository:
$ git clone –mirror http://ipnx.cn/link/8db1625bead0f643f7f7913edc2a8434
3. Set the push location to your mirror:
$ cd repository-to-mirror.git
$ git remote set-url –push origin http://ipnx.cn/link/1345df26413e5a97ce4bddd35cad74b8
A bare clone includes all remote branches and tags, but all local references will be overwritten each time you fetch, ensuring it remains identical to the original repository. Setting the URL for pushes simplifies pushing to your mirror. You can update your mirror through the following commands:
$ git fetch -p origin
$ git push –mirror
That’s everything about GitHub cloning. For more information about the git clone command or any issues related to it, simply search on Google for additional articles.
The above is the detailed content of How to Clone GitHub Repository and Duplicate the Repository?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

This Google translate picture guide shows you how to translate text from an image. If you are looking for more computer tips and solutions, you can visit php.cn Software official website where you can also find some useful computer tools like php.cn

If your Windows 11/10 computer doesn’t automatically the latest versions of device drivers, you will need to manually install them. In this post, php.cn Software will show you 3 different methods to manually install drivers on your device.

This post delivered by php.cn official web page introduces three methods to improve microphone volume and boost its performance, in Control Panel, via Settings, and by Device Manager. Read the below content to view details.

This post includes answers for what is dxdiag, how to run dxdiag in Windows 10/11, DirectX Diagnostic Tool’s main functions, and how to update dxdiag.exe driver. php.cn Software also provides many other computer tips and solutions for users. You can

The operating system is the basic software for managing hardware resources, running programs, and providing user interaction interfaces. It coordinates the relationship between hardware and software and is responsible for memory allocation, device scheduling, file management and multitasking. Common systems include Windows (suitable for office and gaming), macOS (Apple devices, suitable for creative work), Linux (open source, suitable for developers), and Android/iOS (mobile device system). The choice of ordinary users depends on the usage scenario, such as software compatibility, security and customization requirements. How to view system information: Use winver command for Windows, click on the machine for macOS, use terminal commands for Linux, and find the phone in settings. The operating system is the underlying tool for daily use,

Have you ever wanted to adjust computer settings to fix some issues but suffered from Control Panel not opening? There is nothing more frustrating than this app not turning on, stopping you from viewing and changing system settings. In this post, mul

What is Dell Digital Locker? How to log into Dell Digital Locker? This post from php.cn provides answers. Besides, you can know how to use your Dell Digital Locker to find software products included with your Dell computer.

This essay summarized by php.cn Software mainly teaches you how to open Windows 11 Computer Management with Windows Search, Quick Link menu, Run dialog, command prompt, PowerShell, File Explorer, Control Panel, as well as a desktop shortcut.
