Git clone remote repo into another remote repo

datdinhquoc

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.

CodeWizard

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

What can you do?

  • Clone the original repo
  • Add new remote git remote add <origin2> <url2>
  • Use the code from both the repositories inside a single repo

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.


enter image description here

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Working with remote repo git

From Dev

git sparseCheckout repo pushes full repo to remote

From Dev

Push git alias to remote repo

From Dev

Git remote repo, not showing the files

From Dev

Failure to push to remote repo in Git

From Dev

feasibility of git without a remote repo

From Dev

Error Pushing to Remote Git Repo

From Dev

Git remote repo, not showing the files

From Dev

feasibility of git without a remote repo

From Dev

Git remote repo no showing in <ul>

From Dev

Cannot push to remote git repo from one machine to another in LAN

From Dev

Is it possible to get commit logs/messages of a remote git repo without git clone

From Java

Git push existing repo to a new and different remote repo server?

From Dev

Git - Push current Heroku repo to a remote github repo

From Dev

Push local new Git repo to existing remote repo as branch?

From Dev

Git / GitHub: How to get new local repo into empty remote repo

From Dev

Git - Push current Heroku repo to a remote github repo

From Dev

unable to push my local git repo to the remote repo

From Dev

git push to remote repo, but seems nothing is uploaded on repo

From Dev

Remote Repo name changed in Github, but not reflecting in Local Repo with Git fetch

From Dev

How to push bare repo branches to another remote?

From Dev

How to push to remote repo under another user

From Dev

Visual Studio 2013 Configure Remote Git Repo

From Dev

How do determine the URL of a remote git repo?

From Dev

How to compare local with remote git repo in PhpStorm?

From Dev

Force a certain version of git on push to remote repo

From Dev

Check if local git repo is ahead/behind remote

From Dev

When a commit was pushed into a remote Git Repo

From Dev

How to cleanup garbage in remote git repo

Related Related

  1. 1

    Working with remote repo git

  2. 2

    git sparseCheckout repo pushes full repo to remote

  3. 3

    Push git alias to remote repo

  4. 4

    Git remote repo, not showing the files

  5. 5

    Failure to push to remote repo in Git

  6. 6

    feasibility of git without a remote repo

  7. 7

    Error Pushing to Remote Git Repo

  8. 8

    Git remote repo, not showing the files

  9. 9

    feasibility of git without a remote repo

  10. 10

    Git remote repo no showing in <ul>

  11. 11

    Cannot push to remote git repo from one machine to another in LAN

  12. 12

    Is it possible to get commit logs/messages of a remote git repo without git clone

  13. 13

    Git push existing repo to a new and different remote repo server?

  14. 14

    Git - Push current Heroku repo to a remote github repo

  15. 15

    Push local new Git repo to existing remote repo as branch?

  16. 16

    Git / GitHub: How to get new local repo into empty remote repo

  17. 17

    Git - Push current Heroku repo to a remote github repo

  18. 18

    unable to push my local git repo to the remote repo

  19. 19

    git push to remote repo, but seems nothing is uploaded on repo

  20. 20

    Remote Repo name changed in Github, but not reflecting in Local Repo with Git fetch

  21. 21

    How to push bare repo branches to another remote?

  22. 22

    How to push to remote repo under another user

  23. 23

    Visual Studio 2013 Configure Remote Git Repo

  24. 24

    How do determine the URL of a remote git repo?

  25. 25

    How to compare local with remote git repo in PhpStorm?

  26. 26

    Force a certain version of git on push to remote repo

  27. 27

    Check if local git repo is ahead/behind remote

  28. 28

    When a commit was pushed into a remote Git Repo

  29. 29

    How to cleanup garbage in remote git repo

HotTag

Archive