Cloning git repo from remote server to local computer is rather easily done the standard way, but I need to clone a remote repo into another remote repo, is it possible?
P.S. I come up with this problem because I just can't fork my own project on GitHub to create a child project, I can fork the projects of other users only. This is about cloning to make a whole child project from parent project, not just a submodule.
Cloning git repo from remote server to local computer is rather easily done the standard way, but I need to clone a remote repo into another remote repo, is it possible?
In git you can't have .git
folder inside another git folder
git remote add <origin2> <url2>
Now you can pull and merge the branches from the 2 remotes and have the code of both of them in a single repository.
As you can see in the image below you will have 2 repositories which builds up your big repository.
# clone first repository
git clone <repo1>
# add remote
git remote add <remote2> <url2>
# display the list of all the remotes
git remote -v
Note: <remote2>
can not be an existing remote name.