The major issue I was seeing was either all remote branches didn't get recreated in the new remote. Non-destructive (giving pause to the -mirror option).(this was missed on every solution I tried).All branch history are created on new remote.Feel free to flame this to death but for some reason couldn't get the other options to work properly.Įxpected result was a repo "cloned" to another remote (ie from Github to another provider): I found that none of these seemed to work properly for me. Matches your pattern will be pushed to the new remote.įor more information on the topic, check out this thread on Stack Push all the branches or just some of them, Git will perform theĮntire operation without creating any new local branches, and without Git push newremote refs/remotes/oldremote/features/*:refs/heads/features/* Push only the remote tracking branches with names beginning with Oldremote/features/branch3, oldremote/features/branch4, etc.), you can The branch names are namespaced with a slash (e.g., Git push newremote refs/remotes/oldremote/*:refs/heads/*Ĭases, it's also possible to push just a subset of the branches. New remote is called "newremote", you can push just the remote If your old, no-longer-active remote is called "oldremote" and your Option 2: Push without changing your working copy There is a secondĪlternative, which doesn't require a checkout of each branch, doesn'tĬreate extraneous branches in the working copy, and doesn't even Working files with each checkout, and would create a local branch forĮach of the remote tracking branches. Option 1: Checkout every branch and push I could do this, and I couldĮven write a Bash script to help. However, in my case there were dozens of branches, and some or all of This is possible if your working copy contains the tracking branchesįrom the old remote (origin/branch1, origin/branch1, etc.). Repo and all the branch history to your new remote. But you only have the working copy, and the origin is notĪccessible. You have a working copy of a Git repo, say from an old Here's a scenario some of you might have encountered with your Git I used 'git push -all -u newremote', but it only push the checkouted branches to the newremote. Git push newremote -tags refs/remotes/origin/*:refs/heads/* I found the best and simplest method, works like a charm for me, it will push all the tags and branches from origin to the new remote: git remote add newremote new-remote-url git lfs push -all Ībove instruction comes from Github Help: Push the repository's Git Large File Storage objects to your mirror. Pull in the repository's Git Large File Storage objects. Navigate to the repository you just cloned. Replace the example username with the name of the person or organization who owns the repository, and replace the example repository name with the name of the repository you'd like to duplicate. Mirroring a repository that contains Git Large File Storage objectsĬreate a bare clone of the repository. Remove the temporary local repository you created in step 1.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |