How do I use Gitlab server as a central staging server? I just installed a Gitlab instance on my LAN.

I want to use it as the central repository for a Drupal dev->test->prod staging setup.

So, 1st step, I want to push my local "dev" workspace to the Gitlab repo.

Following instructions at Gitlab docs, I try

cd ./drupal8
git remote add origin https://gitlab.example.com/user1/drupal8-test.git


But that fails and returns

fatal: remote origin already exists.


Checking in the drupal dir

cd ./drupal8
git remote -v
    composer        https://github.com/drupal-composer/drupal-project.git (fetch)
    composer        https://github.com/drupal-composer/drupal-project.git (push)
    origin  https://github.com/drupal-composer/drupal-project.git (fetch)
    origin  git@github.com:drupal-composer/drupal-project.git (push)


I want to be able to push to the Gitlab repo, but I still obviously want composer etc to work in my dev env.

What's the right setup &amp; workflow for using Drupal with a central Gitlab repo, making sure that I keep the ability to manage my site in 'dev' with composer?
Usually, people set up a remote named "upstream" for the source, in this case it would be https://github.com/drupal-composer/drupal-project.git. Remote "origin" should be the git URL of your Gitlab repo. So for you, here is a sample workflow:

The setup:

git remote rm origin
git remote rm composer
git remote add composer https://github.com/drupal-composer/drupal-project.git
git remote add origin https://gitlab.example.com/user1/drupal8-test.git


The result:

$ git remote -v
composer    https://github.com/drupal-composer/drupal-project.git (fetch)
composer    https://github.com/drupal-composer/drupal-project.git (push)
origin  https://gitlab.example.com/user1/drupal8-test.git (fetch)
origin  https://gitlab.example.com/user1/drupal8-test.git (push)


Get upstream files:

git fetch composer
git merge composer/8.x


Adding your own files:

touch myfile.txt
echo "hello world" &gt; myfile.txt
git add foo.txt
git commit -m "Added my file."
git push origin master