Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to connect VS Mac to a GitLab repo?

I'm starting a new project using Visual Studio 2017 Community for Mac. I've already set up a GitLab repo for the project, but I can't for the life of me figure out how to connect VS Mac to the repo.

I tried looking in Microsoft's own documentation at https://learn.microsoft.com/en-us/visualstudio/mac/set-up-git-repository and found what, at first glance, looked like an answer. However, when the documentation said to select "Publish in Version Control..." from the Version Control menu, well...

enter image description here

As you can see, there is no "Publish in Version Control..." command. I've been doing Internet research to try to figure out what I missed, but I can't seem to be able to find that out. How can I get VS Mac to connect to the GitLab repo, and what did I do wrong?

UPDATE: I have also taken a screenshot of the right-click menu on the solution. Project names and code have been redacted.

enter image description here

like image 781
Tyll'a Avatar asked Nov 08 '22 16:11

Tyll'a


1 Answers

The Publish in version control option is not meet your situation. It usually used for working at local repo as first (there is no remote repo related), and then connect the local repo to a remote repo.

For your situation, you can follow below steps to connect your remote (GitLab) repo in VS mac and manage git repo versions in VS:

1. Clone/checkout your Gitlab repo locally

VS -> Version control -> checkout -> connect to repository Tab -> select Type as Git -> input your gitlab repo URL -> specify the path/directory as you need -> checkout.

enter image description here

More details, you can refer Checkout an existing repository.

2. Manage versions in local git repo

You can open/edit the files of VS project in the local repo. After finishing working, you can save the changed files.

To commit and push the changes in VS: version control -> review solution and commit -> you can view the changed file(s) -> input commit message -> Commit. In the commit window, you can select Push changes to remote repository after commit option to push changes to GitLab. Or you can push changes to your GitLab repo in version control -> push changes option.

enter image description here

More details, you can refer Reviewing and committing.

like image 135
Marina Liu Avatar answered Nov 14 '22 06:11

Marina Liu