Unable to connect GitLab with Visual Studio Code - visual-studio-code

I'm using a self-hosted GitLab instance deployed for the company, along with Visual Studio Code.
I downloaded the extension "GitLab Workflow" in Visual Studio Code, so I can see my GitLab projects hosted in the company instance.
During setup, I entered:
The company GitLab instance URL "https://XXXXXXXXXXXXXXXXXXXXXXXXXX"
The PAT (personal access token) related to my personal space that contains all my projects.
I also entered the below URL in the configuration file of Visual Studio Code: Settings → Extensions → Gitlab Workflow → Instance URL as described in this article, section: Setup / Step 2:
{
"window.zoomLevel": -1,
"workbench.colorTheme": "Visual Studio Dark",
"terminal.integrated.shell.windows": "C:\\windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
"gitlab.instanceUrl": "https://XXXXXXXXXXXXXXXXXXXXXXXXXX"
}
But when trying to see my GitLab projects from VS Code, I get this error message:
Failed to parse GitLab API response
Command failed with exit code 128: git ls-remote --get-url
fatal: No remote configured to list refs from.
Error: Command failed with exit code 128: git ls-remote --get-url
fatal: No remote configured to list refs from.
at makeError (c:\Users\XXXXXXX\.vscode\extensions\gitlab.gitlab-workflow-3.9.0\node_modules\execa\lib\error.js:59:11)
at handlePromise (c:\Users\XXXXXXX\.vscode\extensions\gitlab.gitlab-workflow-3.9.0\node_modules\execa\index.js:114:26)
at processTicksAndRejections (internal/process/task_queues.js:94:5)

It sounds like the extension doesn't know what remote to fetch from GitLab (a configuration issue rather than connection). Try adding this to your settings.json file:
"gitlab.remoteName": "origin",
If you use a different remote name, then replace "origin" with your remote. You can see the details of your remote using Git:
git remote

Visual Studio Code includes native capability to connect with GitLab.
At "Start", click on "clone repository" and then paste the target URL at the navigation bar:

I found this answer on their docs, if you already using Windows you should turn off your http.systemCertificates in VSC setting.json
thanks to this answer here

Related

Github is not working in Visual Studio Code

I have tried to install the GitHub pull and request extensions in the Visual Studio Code.I installed it. But when I searched "Github" in the Visual Studio there is nothing showing in the visual studio code.
Your question is not clear, but I will try to answer it based on my understanding.
Try with Ctrl+Shift+P and search git, you should see all git commands.
From the official website:
To get started with the GitHub in VS Code, you'll need to install Git, create a GitHub account and install the GitHub Pull Requests and Issues extension.
Once you've installed the GitHub Pull Requests and Issues extension, you'll need to sign in.
After this, you can search for and clone a repository from GitHub using the Git: Clone command in the Command Palette (Ctrl+Shift+P) or by using the Clone Repository button in the Source Control view (available when you have no folder open).

Error: repository checked out but no solution found - when cloning Github repo using Visual Studio 2019 for Mac

Using Visual Studio for Mac (vs 8.10.14) I am trying to clone an existing Github repository.
In Visual Studio I navigate to Version Control/Clone Repository... I fill out the https path (copied from my Github repo) and hit the Clone button. Prompted for Username I enter my Github username and for password I use my freshly generated PAT (Personal Access Token) with credentials for "repo"=Full control of private repositories.
Then the clone process starts but immediately stops with error message: "Repository checked out but no solution found". After selecting the only option "OK", the process stops fully without cloning a single line of code.
Has anyone found a solution already?

Remove connection between VSC Project and Github

I have created a project in VSC and then decided to upload it to my github. I connected VSC with Git and created a repository through VSC. The upload failed so I deleted the repository on Github, but for some reason the project is still connected to github (The letters A,U,M next to the file names) How do I unlink this connection so that my project is again an offline project?
You need to execute in the Visual Studio console the following command
git remote rm
And then restart vscode, it will be disconnected from the git repository

FailedRequest: Service Unavailable(503) for TFS on Visual Studio Code

I'm trying to integrate VSCode with TFS using this Stackoverflow answer.
I have installed the Azure Repos extension and in my settings.json folder, I have done the following:
{
"tfvc.location": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Professional\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\TF.exe",
"tfvc.restrictWorkspace": true
}
While trying to do the team signin portion through the command palette however, I'm prompted with this message:
Provide the username for server (servername:8080)
I enter this and my password, but the connection fails. On the bottom of my VSCode window, I can see this error message when I hover my mouse over the "Team" text:
Failed Request: Service Unavailable(503) - http://servername:8080/tfs/companyprojectcollection/_apis/tfvc/branches
I'm a bit confused. On Visual Studio 2019, to add a server I just had to add the url as http://servername:8080/tfs and login with my credentials, after which I was able to view the workspace/folder that was created for me.
Do I need to edit the initial server it requests me to log into as "http://servername:8080/tfs" instead of "servername:8080", and if so, how?
Why does the error say service unavailable with added folders like companyprojectcollection/_apis/tfvc/branches? How do I fix this?
I could use Visual Stuio 2019, but VSCode is my preferred editor.
EDIT: The error while hovering over the Team button. This is the same format in which I saw the 503 error earlier, except that said "Service Unavailable(503)"
Failed Request: Service Unavailable(503) - http://servername:8080/tfs/companyprojectcollection/_apis/tfvc/branches
From the error message, it seems that the linked URL has some issue. Generally, the URL to connect to the tfvc repo is like this:
http://servername:8080/tfs/DefaultCollection/tfvcrepo
Here are the steps to link the TFVC repo in VS code:
Step1: Create a workspace and map the workspace to local machine in Visual Studio 2019.
Then the Tfvc Repo will be checked out in the path.
Step2: Open either the root folder or a sub-folder of the TFVC repository (workspace path in step1) in VS code.
Step3: Run the team signin command and input the Username and Password. Then the VS code could connect with the TFVC repo.
In this process, there is no process of customizing the URL, it will automatically recognize the tfvc repo related to the workspace.
Note: the settings.json file is still required for TFVC repo. Your settings are correct.
For mode detailed information, you could refer to this Guidance document.

Unable To Clone Azure DevOps Repo From VSOnline

I'm attempting to clone a repo into my workspace on Visual Studio Code Online (Chrome browser) using the Azure Repos extension (https://online.visualstudio.com/environments):
When I attempt to execute the Team: Signin command, I get the error:
When I attempt to clone the repo from the terminal I get:
vsonline:~/workspace$ git clone https://dev.azure.com/MyOrganization/MyProject/_git/MyApp
Cloning into 'MyAppApp'...
Username for 'https://dev.azure.com': myemail#mycompany.com
Password for 'https://myemail#mycompany.com#dev.azure.com':
fatal: Authentication failed for 'https://dev.azure.com/MyOrganization/MyProject/_git/MyApp'
I have this setup with no problem in VS Code on my desktop, what am I doing wrong?
This error is caused by authentication when clone a repo from Azure DevOps Repos, it also led to your Azure Repos extension could not find a repo.
Please check Authentication overview and make sure the Username and Password are correct and workable.
I have been working on this for several days and I finally managed to crack it. 1. select clone in vscode 2. it will ask you to open on new vscode window so click yes 3. head over to devOps and click on generate git credentials 4. copy the long password and paste it in upper password field prompt in vscode
this worked for me so well, happy coding?