Grigore Dolghin
Grigore Dolghin

Reputation: 121

Visual Studio 2017 and Git Clone

This is driving me crazy. We are using a local installation of gitlab and I'm trying to create a new remote repository from Visual Studio, for a new solution.

If I try creating the solution first, then Git clone, it complains the folder is not empty.

If I empty the folder and clone the repository, works, but then I cannot create the solution because it complains the folder is not empty.

So how the heck I am supposed to create a new clone for a new solution?! The remote repository has only readme.md file in it.

Upvotes: 1

Views: 4177

Answers (1)

Fabio Cottini
Fabio Cottini

Reputation: 41

I had the same issue, and I found the same workaround (git clone empty repository, copy .git folder to my app folder, then sync). Lately, I found that it's much simpler:

  • open your solution in VS
  • select "add to source control" (bottom right corner), then select "git"
  • a local .git folder is created, VS also populates .gitignore and .gitattributes, and commits.
  • now, you can notice that Team Explorer page shows a "Publish Git Repo" button, press it
  • enter an URL pointing to a non-existent git repo, e.g. "https://gitlab.com/full/path/to/myproject.git"
  • press "Publish" button

that's all. Obviously, you must have installed GitLab extension for visual studio, before. HTH.

Upvotes: 2

Related Questions