Skip to content

Latest commit

 

History

History
68 lines (39 loc) · 3.43 KB

set-up-git-repository.md

File metadata and controls

68 lines (39 loc) · 3.43 KB
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

Setting up a Git repository

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:

  1. Create a new Git repo at github.com:

    Create new git repo

  2. Set Repo Name, description, and privacy. Do not initialize Repo. Set .gitignore and license to None:

    Set details of git repo

  3. 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:

    view and copy address You will need the HTTPS address to point Visual Studio for Mac to this repo.

  4. Return to your open Project in Visual Studio for Mac.

  5. In the Menu bar, select Version Control > Checkout:

    Start checkout in Visual Studio for Mac

  6. This will display the Select Repository dialog. Choose the Registered Repositories tab, and press the Add button:

  7. 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:

    Enter git details dialog

    Note that it is also possible to use SSH to connect to Git.

  8. 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:

    Attempt to publish project to git

  9. Click Okay, and then Publish from the alert dialog.

  10. 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.

  11. Enter the username and Personal Access Token, and press Okay:

    Enter username and password for git

  12. 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:

    Version Control Menu

  13. Finally, select Push Changes... to push the changes to the remote repository. This will allow all appropriate users to view it on github.com: 

    Push Changes to remote repository