2016. április 3., vasárnap

Adding Alternative Remote Git Repository

I had a large project, which I kept in a Git repository. As a backup I also pushed it to a private Github repository. I wanted it to be private, bacause of the nature of the project, which wasn't in a state to be public.

But, as usual, it was a little problem, which was the price in this particular case. While I kept the private repository on Github, but moving back to a free plan made for me impossible to push changes.

Fortuantely, I heard Microsoft's Visual Studio Team Services has Git support - and quite a bit later - I decided to copy my repository there.

Git not only supports multiple branches, but also supports multiple remote repositories. Which is good if you want to make your life mote confusing :) . The nice thing is that all remote repositories are considered to be the same. So the usual origin/master branch is nothing special and it's the same as teamfoundation/master branch we're going to create.


 In the following, I'll list the commands I used to create the alternative repository, with regards to the existing remote repo.

git remote show - lists all remote repositories
git remote add teamserver "https link from teamserver repository description" - well, it adds the new repo to our local one
git remove show teamserver - lists the details of our remote repository
git push teamserver master - finally, we can push our commited changes to the new remote repository. This command will also create the master branch on the remote server

The funny thing is, that I searched for tutorials how to do this remote repository thing and didn't find in the mean time, that the detail page of my Team Services repo explicitally tells me the needed git command to push the changes there from an existing repository.




 Thanks for reading :)

Nincsenek megjegyzések:

Megjegyzés küldése