How to import a project from Visual Studio Online to GitHub? - github

I have a couple project in Visual Studio Online (VSO), which I would like to move to my GitHub account. In VSO all projects are not publicly-readable. You must be authenticated using Microsoft Account (MA).
I tried to use the GitHub Importer (https://import.github.com/new) to do that. The importer asked me for read-only credentials to reach out to my project. Unfortunately, it cannot go through authentication event though I provide my MA credentials.
Is there anybody know how to import a project from Visual Studio Online to GitHub? Is it even possible?

Okay. I figured it out. You must enable the alternate authentication credentials as described in the following article. After that the importer starts doing its job:
https://web.archive.org/web/20161204015026/https://www.visualstudio.com/en-us/docs/integrate/get-started/auth/overview

If you're importing from Azure DevOps, don't use your account credentials while importing. Instead goto Azure Repos, select your repo which you are importing, then click on Clone and then click on Generate Credentials and then use those credentials in GitHub importer.

Related

How to connect my GitHub Enterprise Account with Visual Studio Code

I want to know if it's possible to connect my github enterprise account of my organization to vs code, and if so how?
I know how to sign in with a normal github account on vs code but it doesn't work for github enterprise. I already looked up online but couldn't find any answers.
In the vs code settings there is an option called github enterprise: Uri. I put there the url of my github organization "github.organizationname.com" but I don't know what else I need to do.
Here's what worked for me on vs code 1.62.3.
Clone the GitHub Enterprise repo outside of vs code (ie, using git cli in a terminal or GitHub Desktop).
In vs code, open the folder containing the cloned repo.
And just like magic, it works. If you click on the source control tab in vs code, you can pull changes and make commits. Actually, it might not work quite yet if your cloned project doesn't have your personal access token saved. If you need to do that, you can find instructions in this answer to a different question
I have set it up in the vscode settings like so:
Then it asked for my personal access token. This is token can be created under "settings" -> "developer options"
see: https://docs.github.com/en/enterprise-server#3.4/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
It is possible to login using GitHub enterprise from VS Code without using personal access token or SSH keys. User can login by SSO if session already exist in browser else will need to sign in using their credentials. One of the ways to achieve this is to install Git Credential Manager. Git Credential Manager (GCM) is a secure Git credential helper built on .NET that runs on Windows, macOS, and Linux.
Compared to Git's built-in credential helpers (Windows: wincred, macOS: osxkeychain, Linux: gnome-keyring/libsecret) which provides single-factor authentication support working on any HTTP-enabled Git repository, GCM provides multi-factor authentication support for Azure DevOps, Azure DevOps Server (formerly Team Foundation Server), GitHub, Bitbucket, and GitLab.
For installing GCM based on OS follow the given link:
https://github.com/GitCredentialManager/git-credential-manager
Once GCM is installed and you try to clone a repository you will be able to see Enterprise login page. This can be achieved by using other Git Oauth Authorized Apps such as GitHub CLI.
Another option is to access with you microsoft email and then , the Github enterprise signing option will be added in "Account" just click it and you now will have access to GithubEnterprise
Account bottom in green
more reference here is the link:
https://learn.microsoft.com/en-us/visualstudio/ide/work-with-github-accounts?view=vs-2022

Azure DevOps view code via web restriction

Does anybody know if it is possible to prevent a user of Azure DevOps from being able to see code on the web interface and force to checkout locally in order to see it. I am looking this feature in Team Foundation Server 2015 as well.
Does anybody know if it is possible to prevent a user of Azure DevOps from being able to see code on the web interface and force to checkout locally in order to see it.
To achieve this, we could set the access level of that specify user as stakeholder.
In this case, that user do not have permissions to see code on the web interface:
To checkout it locally, we could provide a PAT, which have permission access the repo to the user, so that that user could use git command line to checkout it:
git clone <repo>(https://<PAT>#dev.azure.com/<OrganizationName>/MyTestProject/_git/TestSample) <directory>
Besides, this method should also work for Team Foundation Server 2015.
Update:
is it posible to just restrict view of code on the web for a user with
a visual studio subscription, the porblem is that an stakeholder might
be very limited...
The answer is yes. Go to the Project Settings-> Repositories-> Add a specify user and set the Read permission as Deny:
Then we could not acess the code on the web UI:

Visual Studio App Center - VSTS Multiple Organizations

I am currently trying to set up a build through Visual Studio App Center to connect to a VSTS repository.
I have a VSTS account through my works Active Directory and I am also a member of other organizations VSTS instances using the same email. When I connect to configure a build through VSTS, I am only given options to projects that I have access to in only my organization.
I have revoked my initial connection per this, but it is still showing only the projects within my organization when re-authorizing.
Is there a way to connect to projects that are a part of the other organizations I am affiliated with?
Revoke the connection first and then following the steps below:
Switch to VSTS Web Portal.
Click on Personal Settings and click "My profile".
Switch to the Directory which contains the VSTS account you want to connect.
Go back to VSAC and connect to the VSTS. You should see the switched Directory on the OAuth page:

How to use Visual Studio Team Services as a NuGet feed in LINQPad

I am using LINQPad 5 and VSTS (visual studio team services)
I have a NuGet feed (v3) in VSTS and I would like to use packages from there(private) in LINQPad
I have tried using the personal access token from VSTS as the NuGet password in LINQPad
I have tried putting the VSTS credential provider for nuget in AppData\Local\NuGet\CredentialProviders
I have tried putting the VSTS credential provider for nuget in AppData\Local\LINQPad\NuGet\CredentialProviders
I have tried using my VSTS username and password as the nuget credentials
How is this done? Is there a bug in LINQPad? Is this not supported yet?
We managed to get it to work by using the v2 nuget API:
/nuget/v2
instead of:
/nuget/v3/index.json
Just put the personal access token in the password text box on LINQPad Package Sources dialog box.
My current way of getting it to work is as follows:
use nuget v2 feed
https://<instance>.pkgs.visualstudio.com/_packaging/<feed>/nuget/v2
put the personal access token in the password text box
make sure the access token is still valid...
restart linqpad when in doubt! It seems to cache some old credentials (e.g. expired PAT) sometimes
try disabling other feeds so you only have one feed enabled
this helps sometimes: under advanced, enable use legacy search engine (v2)
i'm using a v3 feed in linqpad v6 following the format https://pkgs.dev.azure.com/XXXXX/_packaging/FEED/nuget/v3/index.json
the only way i got it to work was using the PAT (having Packaging Read access) as the username, empty password. #joe-albahari's instructions on the forums and such to use the PAT it in the password field did not work.

log access to code repo in visual studio online

When using visual studio online, we want to ensure that contractors or developer working on project could only check-in and check-out using our given laptops.
Has anyone found a way to restrict access to code from a certain machines in Visual studio Online?
Can we somehow log who checked code out and from which machine at what time?
There is currently no way to restrict access to VSO by IP address. It is something we are considering. What you can do is to enable two-factor authentication in your Azure Active Directory tenant.
There's no way to currently log who has checked out code. The closest you could get would be to periodically query for the workspaces in the account if you are using TFVC. There's no way for you to track clones of Git repos.