Checkout Source code from Visual Studio online GIT source control
With Visual Studio Team Services you could host your GIT repository online in Microsofts Cloud. This makes it easy to share code between Visual Studio and Xamarin Studio. As you cannot use your username within Xamarin Studios GIT client because you cannot use the @-sign from your email address, here is short information about how to set up alternate credentials because it seems that Microsoft has changed the way of creating these credentials as many blog posts are outdated.
So if you have already the source code stored in Visual Studio online repository, how to get and use it in Xamarin Studio?
- Go to your online repository using your browser, e.g. https://myprojects.visualstudio.com.
- In the upper right, move your mouse pointer to your user image. In the new dropdown list select ‘Security’.
- On the security page, you could decide whether you want to create “Personal access tokens” (Personal access tokens can be used instead of a password to allow applications outside the browser access to the resources stored in your account.) or “Alternate authorization credentials” (Alternate authentication credentials can be used to allow applications outside the browser access to the resources stored in your account. ). Both systems have advantages and disadvantages of course. Microsoft recommends to use personal access tokens so in current example we will follow this advice. So click on ‘Add’ to create a new personal access token.
- Now enter some data about the new token and select the scope, e.g. only access to the code, and confirm.
- Back in the overview, you’ll find your new token. Copy the token because Visual Studio Team Service does not store the token so you won’t be able to recover. (Of course you can revoke and create a new one if you’ve lost the token).
- Go to the source code overview of the repository you want to download to Xamarin Studio. This might be a link like https://myprojects.visualstudio.com/projectname/_git/repository. Copy the link into your clipboard.
- In Xamarin Studio, click ‘Version Control’ -> ‘Checkout’.
- In the new window, paste the URL (copied in step 6) into “Server”. Take care to remove “https://” from the address and select “https” in “Protocol” option. Then paste the token (copied in step 5) into “User”. You will see that Xamarin Studio automatically computes the URL into something like “https://token@URL” so that’s the reason why you could use your email address to access your git because the @-sign is used as separator between user and url. Now click “Checkout”.
- Xamarin Studio will ask you now for username and password. As this is a token, you could copy the token code into both username and password.