Pushing vs2022 project to gitlab remote

I have installed gitlab CE on premise and have project in Visual studio 2022 to push to remote.

What I tried:

  • created a project in gitlab
  • added project in remote (project1)
  • Trying to push local project to remote

getting following error:

  • refusing to merge unrelated histories

What’s is best practice to push a new project from visual studio to remote.

First you create a project in gitlab. Make sure to create a blank project, without readme.

Now the new project displays a few different snippets that let you connect this locally. As long as the project is completely empty, you can just create a new project in visual studio, add the gitlab project as remote, and push to that.

If your gitlab project comes with a readme already, you’ll have to clone it into a local folder (git clone ), and then in visual studio create a new project in that folder. Then you can commit to that and push. When cloning, the remote will already be set.