Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unsupported URL protocol in git provider error

I have two separate PCs that connect to the same Gitlab repo. Both running Visual Studio Update 3 and using Team Explorer with Git. On one PC, I have no problem updating the project and then pushing the commits to the remote repo. On the other PC however any operation (push or fetch or sync) will fail with an Unsupported URL protocol error, although originally I managed to clone the repo. I suspect it doesn't like something in the connection string, since I can commit and sync the repo using command line git (version 2.9.2 so fairly recent). What is the cause of this error and is there a workaround?

like image 572
s952163 Avatar asked Jul 27 '16 01:07

s952163


1 Answers

I have checked the difference between the two local repos, and git remote -v on PC1 gives:

origin https://gitlab.com/ ...

while on PC2:

origin [email protected]: ...

After further investigation it appears that the old version of LibGit2 which VS2015 Update3 uses lacks SSH support. The first repo was the original and created in VS, the second repo was cloned via a command-line, hence the SSH connection string.

The workaround is to change the connection string in .git/config to

url = https://gitlab.com/ ...

If one absolutely needs SSH than it is possible to recompile gitlib2, or use command line git which works. It might be possible to use other Git Source Providers in VS2015, however I haven't tested it. (for example Git Source Control Provider 2015)

like image 171
s952163 Avatar answered Oct 06 '22 09:10

s952163