How to connect my GitHub Enterprise Account with Visual Studio Code - github

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

Related

I am trying to get vscode extension gitlab workflow to connect, but get invalid url error

When I launch VSCode with the GitLab workflow extension, I get this error message:
Invalid URL: git#gitlab.com:#####/######.git/
(I have removed address with #).
If I right click and open folder in terminal, I can git push.
When I set up extension, I accepted the GitLab instance and pasted my personal access token.
Do you think I cloned the wrong URL?
This is about GitLab VS Code Extension, code at gitlab-org/gitlab-vscode-extension
First, you should not paste a token for an SSH URL: a token is only used as password for HTTPS URL.
Second, this is followed by gitlab-org/gitlab-vscode-extension issue 385 (initially about HTTPS URL, but with questions around SSH URL as well)
It recommends:
checking the gitlab.instanceUrl setting, or the presence of instanceUrl in your VS Code settings.json.
reviewing the extension logs (CMD+SHIFT+P and enter GitLab: Show extension logs command)
trying to start the VS Code editor, but make sure that the GitLab sidebar is hidden during the start (make sure that you are on, for example, the "explorer" tab when you are closing the VS Code editor so it will start on the "explorer" tab): just to avoid any extension initialization bug.
The error:
[info]: Found gitlab.com in the PAT list and git remotes, using it as the instanceUrl
was seen in gitlab-org/gitlab-vscode-extension issue 307.
And lead to issue 281.
I suggest telling it clearly on the readme to avoid group name in the URL configuration as it is taken from the workspace name.
Note that GitLab 15.0 (May 2022) offers an alternative:
Multiple account support for GitLab Workflow in VS Code
When setting up GitLab Workflow for VS Code, you must provide a token to authenticate to GitLab. This token authenticates you to your GitLab instance as a particular user for checking out code, seeing issues, reviewing merge requests, and more.
In GitLab Workflow 3.44, you can now use multiple tokens to authenticate to the same GitLab instance. This can be great for users who have both work and personal accounts, or accounts with separated duties.
We’ve also improved key storage for tokens, which will now be stored in VS Code’s SecretStorage, and is backed by your operating system keychain.
See Documentation and Issue.
And See GitLab 15.1 (June 2022) adds:
GitLab.com sign-in for GitLab Workflow for VS Code
Getting started with GitLab Workflow for VS Code has been challenging: install the extension, only to learn you needed to follow several extra steps to set the extension up properly. The most difficult aspect of getting started was generating a personal access token with the right scope and adding it to the extension.
Release v3.47.0 of GitLab Workflow now supports OAuth for GitLab.com, removing the need to manually generate a token. This is a huge step in making it easier for you to start using GitLab inside of VS Code.
See Documentation and Epic.

Deprecated password authentication with github warning

Hello community can you please help me out, not very knowledgeable in this area
I got an email from git saying that personal password is no longer gonna be supported and that team city was using it so I went into GitHub and generated a token and added to the VCS in the, after our next deploy I got an email from GitHub saying, you are still using the password dummy, so I asked our server guy to update TeamCity as we were several versions behind, so he did and we ran a deploy again today. I pay a visit to the VCS again and saw my Authentication method was set to Password/Token. I got no email from GIT this time saying I was dummy and "Developer Settings/Personal access tokens" mention TeamCity has used it but TeamCity keeps saying this ▼▼▼▼ any ideas ?? Thanks.
git) https://github.com//xxxxxxxxxx is using deprecated password authentication with github.com and will soon stop working
Please consider switching to either personal access token or to SSH private key authentication.
Edit VCS root
Solution as mentioned in the error.
It is also mentioned on TeamCity documentation
You may either use SSH priv/pub keys as authentication or "Personal Access Token".
I can tell by git) https://github.com//xxxxxxxxxx that you are currently using HTTPS instead of SSH to source your VCS, so the most similar solution is GitHub Private Access Token (linked: how-to)
Go to Setting > Developer Settings > Personal Access Token and click "Generate New".
If this is a private GitHub repo, you will need to tick the "repo" scope.
On your TeamCity VCS change the password to be the Personal Access Token you generated.
Tip: since you can not view the PAT after generating nor after using on the VCS, it is recommend to set the PAT as a root configuration variable, so you can call it on this VCS, build features, or other future use.

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:

Where do I enter my Visual Studio Team Services username and access token in GitHub Desktop?

A colleague has been having problems logging in to our Git repository hosted in Visual Studio Team Services (was Visual Studio Online) using GitHub Desktop on the Mac. He use to have access but now cannot fetch, push, etc. Yesterday my VSTS token failed and GitHub Desktop presented me with a login window where I entered a new personal access token that I generated on our project's VSTS portal. So today I thought I'd show him how to do that. I started by revoking my personal access token in the VSTS portal. Now I cannot get access nor can I see where to enter new credentials!
When I click 'sync' in GitHub Desktop here's what I see:
Authentication Failed
You may not have permission to access VisualCollectionsIOS. Check
Preferences to make sure you’re still logged in.
But the preferences have nowhere to add my VSTS username and access token.
Where in GitHub Desktop can I enter my username and access token for my Git repository hosted in a team project in VSTS?
You can update the credentials from OSX Keychain. Check the steps in this link for reference: Updating credentials from the OSX Keychain. Instead of searching for the github.com password, as the reference suggests, search for the visualstudio.com password. When the visualstudio.com password entries are deleted GitHub Desktop will prompt you for your username and personal access token again.

How to import a project from Visual Studio Online to 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.