Reputation: 7861
I have a repository that is on Github and I want to move it to Codeplex.
I want to take all of the existing commits from my Github repo and push them to a new Codeplex repo.
I don't think this is the right approach, but I tried:
git remote github add url
git remote update
git add .
git commit
But there is nothing to commit, it downloads the github repo, but the working directory is empty.
How do I switch to the Github master branch, add all of the files to the Codeplex master branch, and push the commits to Codeplex?
Ideally moving forward I would like to be able to continue working on the Github branch and push changes to Codeplex.
Upvotes: 3
Views: 812
Reputation: 56859
Keeping 2 repositories in sync is going to be a nightmare. You should instead consider making a mirror repository.
If you haven’t cloned the repository before, you can mirror it to a new home by
$ git clone --mirror [email protected]/upstream-repository.git
$ cd upstream-repository.git
$ git push --mirror [email protected]/new-location.git
This will get all the branches and tags that are available in the upstream repository and will replicate those into the new location.
Warning
Don’t use git push --mirror in repositories that weren’t cloned by --mirror as well. It’ll overwrite the remote repository with your local references (and your local branches). This is not what we want. Read the next section to discover what to do in these cases.
Also git clone --mirror is prefered over git clone --bare because the former also clones git notes and some other attributes.
Upvotes: 0
Reputation: 3650
For codeplex, your remote (or clone) url will be like: https://{git-server}.codeplex.com/{project-name} (i.e. https://git01.codeplex.com/eisk)
So, it will be like
git remote add my-project-at-codeplex https://git01.codeplex.com/eisk
git push my-project-at-codeplex master
You can do the same from the opposite direction (i.e. from codeplex to github in the same way. A good step by step details can be found here.
Upvotes: 0
Reputation: 84343
Assuming you've already set up your Codeplex repository, and that GitHub is currently marked as origin, then you can do something like this.
git remote add codeplex https://foo/bar/baz
git push codeplex master
To review your remotes, use git remote -v
and you'll see what remotes you've defined, as well as the URLs they point to. You can work with multiple remotes; just make sure you've got both GitHub and Codeplex correctly set up as remotes. You can then push/pull from GitHub as you normally do, and then explicitly push to Codeplex whenever you want.
Upvotes: 5