Search code examples
gitrepositorygit-remote

Pushing info from a private git server to a service like gitlab


I have been contemplating getting a Bitscope Raspberry Pi Blade Server for a while and wanted to install git-core onto it. I was wondering if there is a way to take the local repository and commit the changes to that repository to a service provider like gitlab. I am wondering this because I'd like to have a complete off site version of all of the code. Is this possible?


Solution

  • There are two options for this as below.


    Two remotes locally

    You can add two remotes locally

    git remote add blade https://example.com/user/repo.git
    git remote add gitlab https://gitlab.com/user/repo.git
    

    (presuming you've not added any remotes already - if you have just add the one that is missing).

    then you can execute

    git push blade {branch-name}
    git push gitlab {branch-name}
    

    when you want to push to the two separate remotes respectively.


    Extra remote on your blade server

    To add a remote you can run:

    git remote add gitlab https://gitlab.com/user/repo.git
    

    then you can execute

    git push gitlab {branch-name}
    

    to push to gitlab