title | description | author | ms.author | ms.date | ms.topic | ms.assetid |
---|---|---|---|---|---|---|
Setting up a Git Repository in Visual Studio for Mac |
Using Git and Subversion in Visual Studio for Mac. |
asb3993 |
amburns |
04/14/2017 |
article |
E992FA1D-B2AD-4A28-ADC6-47E4FC471060 |
Git is a distributed version control system that allows teams to work on the same documents simultaneously. This means that there is a single server that contains all the files, but whenever a repository is checked out from this central source, the entire repository is cloned locally to your machine.
There are many remote hosts that allow you to work with Git for version control, however the most common of these is GitHub. The example below uses a GitHub host, but you can use any Git host for version control in Visual Studio for Mac.
If you wish to use GitHub, ensure that you have an account created and configured before following the steps below.
To set up a Git repository, execute the following steps:
-
Create a new Git repo at github.com:
-
Set Repo Name, description, and privacy. Do not initialize Repo. Set .gitignore and license to None:
-
The next place will give you an option to display and copy either the HTTPS or SSH address to the repo you have just created:
You will need the HTTPS address to point Visual Studio for Mac to this repo.
-
Return to your open Project in Visual Studio for Mac.
-
In the Menu bar, select Version Control > Checkout:
-
This will display the Select Repository dialog. Choose the Registered Repositories tab, and press the Add button:
-
Enter the name of the repository as you would like it to display locally, and paste in the URL from step #3. Your Repository Configuration dialog should look similar to the following. Press OK:
Note that it is also possible to use SSH to connect to Git.
-
To attempt to publish the app to Git, select the repository just created, and ensure that both Module Name and Message text fields are completed:
-
Click Okay, and then Publish from the alert dialog.
-
If you have not already entered your Git credentials in Visual Studio for Mac preferences, enter them now. First, you need to create an Access Token, which is used in place of a password. Follow the steps in the Git Access Token documentation to do this.
-
Enter the username and Personal Access Token, and press Okay:
-
After a few seconds, the Solution should be published. Confirm this by browsing the Version Control menu item, which should now be populated with many options:
-
Finally, select Push Changes... to push the changes to the remote repository. This will allow all appropriate users to view it on github.com: