138

I just installed Visual Studio Code 1.17 and opened a Git repository folder. When entering the Source Control tab I see a message "There are no active source control providers". I thought Git was baked into VSCode!?

To make matters worse, when I attempt to install additional SCM providers there is no option for Git. How do I get my Git back!?

Visual Studio Code, displaying “No source control providers”

ChiliYago
  • 11,341
  • 23
  • 79
  • 126
  • 3
    Hmmm, I get "Source Control:Git". Maybe restart VSCode to see if it fixes it? – Mark Oct 06 '17 at 15:44
  • restart did not fix it. – ChiliYago Oct 06 '17 at 16:02
  • 1
    Can you try clicking on the overflow menu (the three dots) in the source control panel and choose “Switch SCM Provider” there, to select Git? – poke Oct 06 '17 at 17:29
  • Can you post a screenshot of what you can see in the Source Control tab, @ChiliYago? – ifconfig Oct 06 '17 at 19:48
  • i'm having the same issue. environments: windows 10 i tried all the solutions above, but does not work. then, there's a **official update** coming, the git is **present** after completing the update. hope it will helps. – Marshall Fate Dec 21 '17 at 01:37
  • Same problem here, new git clones will not see git versioning anymore – Kokodoko Mar 27 '19 at 17:09
  • See also https://stackoverflow.com/questions/29971624/visual-studio-code-cannot-detect-installed-git – Yost777 Apr 02 '19 at 09:39
  • You can try to install jira and Bitbucket Extension – Sakhawat Hossain Sohel Aug 02 '22 at 16:20
  • My similar issue in Windows after I migrated my user profile to a new laptop. I re-applied the ACL owner (me) to all children under my home folder. I got this error when fetching: "detected dubious ownership" which led me to the ACL solution. – tonypags Oct 12 '22 at 15:53

46 Answers46

100

Wow I spent so long on this. For me I had to go to the Extensions area > then click the ... at top right of menu > Show built-in Extensions

Git built-in extension was disabled!!

screencapture

Rel
  • 2,494
  • 2
  • 15
  • 15
60

Are you using MacOS? If you've updated Xcode lately, you may need to accept Xcode's terms of service agreement to use git.

$ sudo xcodebuild -license accept

johnwp
  • 706
  • 4
  • 7
  • 4
    This question is about VSCode, not XCode. – ifconfig Oct 06 '17 at 17:25
  • 23
    @ifconfig: the question might be about VSCode but the answer is absolutely valid and correct, you need to accept Xcode's terms of service agreement in XCode to use git in VSCode (at least I had to, so this was the answer I was looking for) – Lukáš Rubeš Oct 25 '17 at 18:32
  • 2
    After updated Xcode my git in VS code is not working anymore. This answer is very helpful!! – laishiekai Nov 09 '17 at 00:32
  • Sounds very stupid but can someone show me how to "accept Xcode's terms of service agreement"? Is it "sudo xcodebuild -license accept"? – laishiekai Nov 09 '17 at 01:38
  • Ok for me to get git back to vscode in MacOS: I accept the xcode license, overwrite the git.path in the settings, and also open an existing repository. After trying all these and I reload the c++ plugin, suddenly git is back. This is black magic... – laishiekai Nov 09 '17 at 18:21
  • 14
    That command returns: `xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance` – Ian Vaughan Aug 16 '18 at 16:37
  • This fixed my problem. – Dennis Liu Feb 08 '19 at 23:09
  • 1
    worked for me. I ran the command, then reopened VS Code and then command+Shift+P -> Git:Clone, and it worked as expected. – behold Mar 26 '19 at 00:14
  • This worked for me + window reload (CMD+SHIFT+P -> type "reload") – Smitty Oct 17 '19 at 19:03
38

What helped me is setting the value of git.path setting to the full path of my git.exe file. After that I was able to see the git logo:

git icon

torvin
  • 6,515
  • 1
  • 37
  • 52
  • OP mentioned in a comment, that `git` is in the PATH and can be used from the Windows command line. Setting `git.path` is only necessary if that wouldn’t be the case. – poke Oct 09 '17 at 18:29
  • 1
    @poke still worth a try, since `git` being on `PATH` doesn't work for OP. Also useful for people who don't want `git` on `PATH` – torvin Oct 09 '17 at 21:20
  • Sure, I’m just saying that if this ends up working, OP lied to me ;P – poke Oct 10 '17 at 07:00
  • OK, let's wait for his response haha ;) – torvin Oct 10 '17 at 10:44
  • So much for that… *\*sigh\** – poke Oct 12 '17 at 07:32
  • 6
    This does not work for me. 1st I´m not on windows, 2nd: if I add "git.path": "/usr/local/bin/git", to the settings it says: Unknown configuration setting, so where did you set this variable? – Macilias Mar 09 '18 at 10:36
  • Not working for me either. VS Code can find the git folder, but just refuses to recognise that a folder is under git control. – Kokodoko Mar 27 '19 at 17:22
  • @torvin where i can submit git.path? – Gem Jul 24 '19 at 09:20
  • @Gem `File -> Preferences -> Settings` and enter `git.path` into the search box – torvin Jul 24 '19 at 10:20
  • @Gem weird, mine doesn't look like this. but anyway, click on the `{}` icon in the top right corner and put it into json manually – torvin Jul 24 '19 at 10:37
  • @Gem looks like you're lacking the git extension completely... not sure how that happened. Try re-installing the latest version of VS Code? – torvin Jul 24 '19 at 11:19
  • Worked for me. In my case my "git.exe" was buried inside the Fork installation (a git client) – frankieta Dec 03 '19 at 11:51
  • I did this but it didn't work. I have 2 projects in the same pc (win 10), one can show the source countrol to push to origin server, the other cannot display the source control properly, I can commit but cannot push. I have to type manually on console to push : git push origin master and it works. I tried the other project on other pc as well but it didnt work – nightingale2k1 Jan 18 '20 at 01:25
  • 1
    Late to this party but... @Macilias any issue with "git configuration" refers to the ~/.gitconfig file. For example, bad syntax. Refer to the git-scm docs for help with that, but sometimes looking at the file you will see something obvious or a typo so try that first. – tonypags Jan 18 '23 at 19:44
25

I had this too. tried overriding the default git.path setting but that didn't work. What seemed to fix it for me was opening an existing repository .. just an empty folder that I created and did a 'git init' in at the command prompt. After I opened that folder I could click the Source Control button and it had all the git functions available and no longer said "There are no active source control providers". Furthermore, doing File->Close folder got me back to where I started. Another way was to click the small "branch" button ABOVE that message ("There are no active ...") and initialise a repository. This message is very confusing!

RodB
  • 251
  • 2
  • 2
  • On Windows, with a fresh installation of Git and VS Code, using all default settings, this is the correct answer. The 'No Source Control Providers' message refers to the current workspace and not the application. See also: https://github.com/microsoft/vscode/issues/61491 – jamiecon Sep 11 '19 at 23:44
  • me2. Had been breaking my head over this, until I found this answer. Opened a directory containing a working copy that had previously been cloned by Sourcetree, and the git sidebar just started working. – Luc VdV Oct 08 '19 at 13:25
16

Visual Studio Code does come with in integrated Git source control provider. However, in order for that to work, Git itself needs to be installed on your system as well. So just download and install Git on your machine, and Visual Studio Code will also be able to use it.

While the source control panel does not tell you this, but unfortunately just stays quiet about it, not offering anything, there is a way to have VS Code tell you this: On the “Welcome” page that is displayed when you start the application, there is a link “Clone Git repository…”. If you click there, VS Code will tell you that Git is missing:

It looks like Git is not installed on your system

Once you have installed Git and restarted Visual Studio Code, you will see a small Git icon at the top of the source control panel (unless you already have a repository opened of course):

Source control panel with a Git icon

This will tell you that Git is there and you can click the icon to initialize a repository—or just open an existing repository.

poke
  • 369,085
  • 72
  • 557
  • 602
  • 2
    I have Git installed on my machine. Git status on the command line works just fine. I did mentioned that I am opening a git repository. – ChiliYago Oct 07 '17 at 16:51
  • Is Git in the PATH? Can you run Git commands from the Windows command line? – poke Oct 07 '17 at 17:28
15

Open Visual Studio Code, click left-bottom ⚙️ (gears) and select Command Palette.

Search for the word "enable", and select Enable All Extensions.

wa liqi
  • 151
  • 1
  • 3
13

For me, the solution was (on Mac) Code > Settings > User Settings > Extensions > Git

Check the (unchecked) box next to Enabled - Whether git is enabled.

Git enabled setting

Brian Cragun
  • 680
  • 8
  • 13
12

Simplest steps what worked for me:
1. Download and install Git on your machine as mentioned in Poke's answer.
2. Restart VS Code.
3. Open Command Prompt (Crtl+Shift+P) and write 'Git: Initialize Repository' and choose a folder you like (it can be even a temp folder).
4. Finally Git logo appears as shown in Torvin's answer and then its easy to set up your git account and start using it.

Randel
  • 421
  • 6
  • 11
10

You need initialize (git init in terminal) your project/folder, that your VS Code to be able to see his as git-project.

Enter in your project/folder through terminal

cd ~/ImbaFolder
git init (it created .git file - the git repository)

Then your VS Code will to see that it is git repository, and it will works.

aprinciple
  • 704
  • 5
  • 8
  • Closest match. Checked out code - aka Cloned repo - to local folder via Git for Windows. Right-click Opened folder with VS Code. Finally the Source Control area was alive. – SushiGuy Mar 05 '19 at 19:04
8

If this helps; I did face the same issue with the latest version of VS Code and tried all the mentioned tips, but no luck. Finally, I added a folder to a workspace, saved that workspace, and then when I checked the repo icon, could see the small git icon and can as well clone a repo from the command palette.

Raised an issue for this and commented the same findings. Can be found here https://github.com/Microsoft/vscode/issues/49469

David Refoua
  • 3,476
  • 3
  • 31
  • 55
Rahul
  • 76,197
  • 13
  • 71
  • 125
7

So, I tried all sorts of things to get this to work. I tried "git.path": "/usr/bin/git", adding git directly to my path, etc. Nothing worked.

Finally, I realized that in my VSCode workspace settings, I had "git.enabled: false". I changed it to true, and it works like a charm.

justinbc820
  • 963
  • 1
  • 10
  • 15
7

Enter the Add-ons field in VS Code and; @builtin git write. For Example

enter image description here Then enable it.

Fırat DİKMEN
  • 479
  • 5
  • 8
  • when you add @builtin git you also need to download git from https://git-scm.com/download than connect with github easily. – shaz3e Apr 20 '23 at 22:31
6

My plugin was disabled, just enabled it.

  1. Go to extension(click on the extension icon on the left),
  2. Serach for @builtin git,
  3. Enable the git default built in extension,
  4. It started to work for me again.
Deepak Jha
  • 1,539
  • 12
  • 17
5

Try xcode-select --install. In macOS git is attached to XCode’s Com­mand line tools

Evelina
  • 69
  • 2
  • 2
    The question is not about Xcode. It’s about Visual Studio Code. – poke Oct 06 '17 at 19:22
  • 1
    @poke and that is exactly what fixed my vscode "There are no active source control providers" issue! You need to do it if you have just updated your mac fx. – Evelina Oct 06 '17 at 20:09
  • The question at no point suggested the operating system that was being used. Now, there is a screenshot obivously showing a Windows system, so your answer does not really help. – poke Oct 07 '17 at 13:23
  • 1
    This answer really helpful when MacOS update to High Sierra version. – Shawn Wu Dec 16 '17 at 09:38
  • I've tried changing the "User Settings" in VSCode on Mac and it will not work. However, this solution worked because "Developer Command Line Tools" isn't installed on a Mac, Windows (10) simply needs Git installed. – Jason Foglia Jan 14 '19 at 04:15
5

So I tried nearly every answer and nothing.

  • Re-install Git
  • Initialize an empty repository locally with git init
  • Checked to make sure the @builtin git was enabled
  • Restart VS Code multiple times

I ended up trying Ctrl + shift + G and noticed a command at the bottom of VS code.

enter image description here

All I did was press the G key and the icon suddenly appeared and everything works perfectly!

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Stephen Romero
  • 2,812
  • 4
  • 25
  • 48
5

That is because the built-in git is disabled in your vs code either because of installing any git package or you accidentally disable it.

For enable it

  1. Go to vs code.
  2. Open extensions and search for @builtin git.
  3. Now you will see a git extension in it.
  4. Now click enable if it is disabled.
  5. And visit source control. You will see the clone repository
Nimantha
  • 6,405
  • 6
  • 28
  • 69
SS BHARGAV
  • 51
  • 1
  • 1
4

Tested in VsCode on Windows dev PC.

What worked for me was to enter Settings by hitting Ctrl + , at least on my machine and then enter the following setting: SCM.provider.AlwaysShowProviders

Then just ticked the checkbox and Git was lighting up again and I could then go to Source Control by Ctrl+shift+G.

Tore Aurstad
  • 3,189
  • 1
  • 27
  • 22
  • "Ctrl+shift+G" worked. Apparently, unlike other buttons like explorer, search clicking on the git(SCM) button completely removes it.. Ctrl+shift+G brings it back – Neelabh Mam Nov 28 '19 at 09:23
3

Since i installed GIT in custom defined path, i needed to reference it inside settings.json

( F1 > settings.json > enter )

Add setting:

"git.path": "<custom path to git.exe>"

Wich in my case made it look like:

{
    "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\cmd.exe",
    "git.path": "<custom path to git.exe>"
}

Right after it worked perfectly.

  • Works perfekt! Thanks. After entering "settings.json" in the search field, I choose "Preferences: Open Settings (JSON)". Nice hint to use F1 (works like Strg+Shift+P). – snukone Apr 01 '20 at 11:42
3

For future prospects, if anyone is facing a problem like mine. This may be a solution.

Right-click and enable the option.

saad shafiq
  • 166
  • 5
  • Settings -> git.enabled, which can easily open up by Ctrl+Shift+G. It's quite curious that in @builtin git says enabled globally, but the label is not present and the feature is not enabled. Must be explicitly in the settings. – m3nda May 23 '23 at 10:02
2

I found that VScode stopped tracking after I checked out a different branch (new one). What solved it was simply:

  • Closing the working folder.
  • Reopening the folder.

VSC then synced with the new branch and showed the differences.

Omer Greenwald
  • 758
  • 7
  • 20
2

Solution For Mac Users

This is simple way and this way has been solved my problem on Mac:

1) Run this command on console :

sudo xcodebuild -license accept

2) Close Visual Studio Code and reopen it.

That's it.

Note : If you are using MacOS and you have updated your Xcode recently, you may need to accept XCode's terms of service agreement to use git.

Ali
  • 2,528
  • 1
  • 9
  • 14
  • 1
    What does this do? Seem like this command is a catch all for acceptance of any license, which seems very dangerous, can you please clarify? – Jason Foglia Jan 03 '19 at 05:12
  • Hi Jason Foglia. This solution for MacOS users. If you have updated your Xcode recently, you may need to accept Xcode's terms of service agreement to use git. (Also it was described here by johnwp: https://stackoverflow.com/a/46610954/5736731 ) – Ali Dec 03 '19 at 18:06
2

I ran into the same problem and figured out that VSCode does not recognize git repo unless it is added to a workspace.

So, add the folder you want to be tracked via Git into a workspace and git will be enabled automatically.

2

I did not see the Git controls until I created a file and saved the current workspace - suddenly "Source Code Control" showed the Git Icon and I could initialize a new Git repo.

Cloning an existing repo seems to be unsupported in VS Code, and I guess that is the reason that Git controls are hidden until there is a workspace where a new repo can be initialized.

peschü
  • 1,299
  • 12
  • 21
2

I just fixed this problem. I newly installed VS Code and this problem occurs.

OS: Ubuntu 18.04.2

On my source control tab, it shows "no source control providers registered".

Here's how I fixed this problem.

  1. Edit the setting file, set the gitpath to /usr/bin (my git dir)
  2. Run git init command in my project folder
  3. Press ctrl+shift+P and run "reload window" command

And this problem is fixed.

tripleee
  • 175,061
  • 34
  • 275
  • 318
Xiao Long
  • 21
  • 1
2

Scenario: For MAC + issue afer installing/updating xcode:

Can also happen when you install xcode and yet to accept the license terms. To accept the terms, just run the below.

sudo xcodebuild -license

Post to this restart VS code & you are good to go.

sri
  • 801
  • 9
  • 10
1
  1. If SCM view is empty you need to install a source code provider.

  2. Check Extensions (Ctrl+Shift+X) under View and select the SCM provider you want. Start typing @ca and you will see extensions listed. Select @category: “scm providers” to see available SCM providers.

  3. If you don’t see Git here you need to install Git. Here’s their download page for windows. https://git-scm.com/download/win

  4. After installing you’ll see Git Extensions for VS Code listed under Extensions view. Select it and click install on the right hand side panel that appears.

  5. After installing the SCM remember to close and reopen VS Code.

Daneesha
  • 313
  • 4
  • 10
1

The reason for this problem is that Git is not initialized in the folder that you are trying VS Code to open (this is for Windows 10).

  • Install Visual Studio Code from https://code.visualstudio.com/download
  • Install Git from https://git-scm.com/
  • Create a folder named git in: C:\Users\YourName\ so it will look like this C:\Users\YourName\git (<-- you can pick any directory)
  • While you are in that folder, right-click > Git GUI Here > Create New Repository
  • In pop-up window Browse for the folder you just created (to initialize Git there) > click Create
  • This will create a .git file in that folder
  • Open VS Code > File > Open Folder > (select the folder you just initialized Git at)
Ahmet
  • 908
  • 1
  • 17
  • 26
1

Just close the editor and reopen. That did the job for me.

Fotios Tsakiris
  • 1,310
  • 1
  • 18
  • 24
1

I incidentally dragged the git icon to the search panel, just drag it back to solve the issue.

Elia Weiss
  • 8,324
  • 13
  • 70
  • 110
0

Adding another solution in case someone like me runs in to this again.

I had just setup a new node project and I was getting this. I had to create a .gitignore file and add node_modules to it and then vscode looked correct. From what I can tell it might be because there are other git repos in the my node_modules and vscode was seeing those as well. Not sure the technical reasons but that seems to have fixed it for me.

Bryan
  • 111
  • 1
  • 2
0

I see that Cygwin isn't mentionned here. It happened to me and I found the solution https://github.com/Microsoft/vscode/issues/7998#issuecomment-245356777.

If you are using Git from Cygwin.From Windows terminal, execute the following command :

> cd c:\
> md cygdrive
> cd cygdrive
> c:\ - mklink /j "c" c:\

(Assuming that git is stored in the following folder : C:\Cygwin\bin\git.exe)

Now, restart VSCode

snoob dogg
  • 2,491
  • 3
  • 31
  • 54
0

None of this worked for me. Was annoyed so much that I swept cleaned my installation to see if that makes a difference. That also did not work.

What worked was

Click on View > Open View > Source Control

This will open the git view.

When the git view is shown, right click on the Icon > Click on "Keep"

VS Code Keep Source Control

aksappy
  • 3,400
  • 3
  • 23
  • 49
0

This panel will remain blank - by design apparently. Even after installing GIT and VS Code finding it, nothing will be shown here. No need to install other extension, as GIT extension (now) comes default with VS Code. I only install Windows GIT, which VS Code will find as long as it's in the PATH.

You need to manually add repositories to populate this window. https://code.visualstudio.com/docs/editor/versioncontrol#_git-support

"You can clone a Git repository with the Git: Clone command in the Command Palette (Ctrl+Shift+P). (edit: Type in 'git: clone' in the command box) You will be asked for the URL of the remote repository"

I hope this helps someone as there is so much confusion about this. MS should really improve how this behaves for a more consistent user experience - which they may well do at some point.

Yost777
  • 597
  • 1
  • 6
  • 19
0

All I had to do is select a git controlled folder. This made git icon appear and looks like now it appears every time. Maybe I just had to select a folder...

Igor
  • 1,212
  • 12
  • 23
0

If you have your Git repo opened on another machine it will not be available on the machine you are currently using. You have to close the VSCode instance on one machine before you can access your source control on another.

double-beep
  • 5,031
  • 17
  • 33
  • 41
Naldo Ash
  • 3
  • 1
0

In my case the Git was installed on my machine, VSCode->settings->Git was enabled, path to git.exe was set, even then it was showing me the same error i.e. "No source control providers registered."

Finally by running the following command from "Command Palette" I was able to clone my repository and that message went away.

>Git Clone

I got the idea of above command from following VSCode online documentation.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Syed
  • 1
  • 2
0

I just disabled and reenabled the built-in git extension on Mac.

kaidoj
  • 353
  • 1
  • 4
  • 5
0

In my case, For Ubuntu 18.04.2. I uninstall the program [from (Ubuntu software) or programs (menu)], and then delete all .vscode carpets in ../../desktop then install visual studio code again. that fixed. Note: The extensions delete too.

Visual Studio Code screenshot

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
0

In my case specifically I was opening the folder from a terminal window that was set on a version of node I did not install git in. I changed to my previous version and it all worked normally.

When using nvm it installs programs on specific folders for your version of node. I had git installed on v12 but was trying to use it on v16.

To solve this you can install git for all the versions you have on your computer or you can try to install the programs for all versions.

0

In my case I just close VS code, and then open new window and open folder, like this:

enter image description here

Lucas Prestes
  • 362
  • 1
  • 4
  • 19
0

I experience the same problem each time I open VS Code now. It fails to detect the project's git source control - even though I can access and infer the project's history and current changes via the integrated terminal.

The following solution works for me every time and nudges VS Code back to life by reawakening the project's source control...

  • Open the command palette (ctrl + shift + p)
  • Type/search for a "safe" command, e.g. Git: Open All Changes or Git: Fetch or Git: Pull
  • Press Enter

This will prompt a VS Code alert with the following message

Git: There are no available repositories

But just cancel that and you will see that all the source control goodness and file tracking has been restored.

Wayne
  • 61
  • 1
  • 3
-1

Realizing this is an old thread, but you have to set the path to git in VS Code's settings.json file.

{
    "git.alwaysShowStagedChangesResourceGroup": true,
    "git.autofetch": true,
    "git.path": "D:\\program files\\Git\\bin\\git.exe"
}
-2

I'm having the same issue as OP. My issue started when I installed a PHP autocomplete extension. I uninstalled the extension and poof, source control is back.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
-2

Here's what worked for me:

  1. I uninstalled VS Code
  2. I deleted C:\Users\myusername\AppData\Roaming\Code
  3. Re-installed VS Code
Eleo
  • 1
  • 2
-2

There is a simple solution to this I found. 1/ In the View menu item at the top, click on SCM. The SCM menu item will appear on the left side. This is what you want. 2/ Right click on the SC icon and select the keep checkbox. This keeps the SC icon in place.

arame3333
  • 9,887
  • 26
  • 122
  • 205
-3

You can try to install Jira and Bitbucket Extention