Reputation: 608
I have installed husky in my project. Then I ran the precommit
command. Now, when I run the git
command, it is not working and it's instead asking me how do you want to open the file. So, I removed husky using npm prune
and then removed the hooks folder from /.git
of the project directory, but still didn't help. I am using Windows 10.
Upvotes: 10
Views: 79226
Reputation: 1
I have same problem and below step help me to fix my problem:
unistall vs code and git then install them again.
check the version of git
go to settings Git:Enable and check it
in your Terminal write:
git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
git commit -allow-empty -n -m "Initial commit"
Upvotes: 0
Reputation: 1
Had this same problem. Below is the solution that worked.
Don't know why powershell isn't working but changing to either CMD and Git bash works just fine.
Upvotes: 0
Reputation: 1
I was facing the same problem, however my git --version
was working on cmd.
I have set up C:\Program Files\Git\bin
and C:\Program Files\Git\cmd
in PATH
(Windows -> envirorment variable -> PATH). Once I did that I restarted cmd and Visual Studio Code and it fixed the issue.
Upvotes: 0
Reputation: 77
Try running git config --global safe.directory *
in your terminal.
Upvotes: -2
Reputation: 189
I had a somewhat similar issue - VS Code stopped working with Git (for example: no change detection, problems with fetching from remotes), but I couldn't find what caused this issue (I didn't install Husky like what the OP did).
Inspired by @user9795515's answer, I resolved the problem with Git by restarting the Git feature in VSC:
Upvotes: 8
Reputation: 753
After reading the other posts with their answers of deleting and reinstalling Git and Github, I discovered that I had the Atom GitHub package installed from prior experiments. I deleted Atom and restarted VSCode and it now works with the Git repo.
Upvotes: 5
Reputation:
First, in the built-in terminal, type: git --version
.
If that command does not work, download and install the latest version of Git. Else, in VS Code's extensions, in the search bar type: @builtin
. This will list all the built-in extensions in VS Code categorized under different sections. In the 'Features' section look for Git extension. Check if it is disabled. Enable it and your version control should start working.
Upvotes: 15
Reputation: 874
Try to check from Terminal, if Git command is recognized.
Curently I'm using Powershell terminal.
git --version
this should be return like this git version 2.28.0.windows.1
If that doesn't work then try these steps:
"terminal.integrated.profiles.windows": {
"PowerShell": {
"source": "PowerShell",
"args": ["-NoExit", "-ExecutionPolicy", "Unrestricted", "-NoProfile", "-File", "C:\\Users\\LENOVO\\Documents\\WindowsPowerShell\\bootstrap-git.profile.ps1"],
"icon": "terminal-powershell"
},
"Command Prompt": {
"path": [
"${env:windir}\\Sysnative\\cmd.exe",
"${env:windir}\\System32\\cmd.exe"
],
"args": [],
"icon": "terminal-cmd"
},
"Git Bash": {
"source": "Git Bash"
}
}
git --version
.bootstrap-git.profile.ps1
file which is used in Point 2.# Start a transcript
#
if (!(Test-Path "$Env:USERPROFILE\Documents\WindowsPowerShell\Transcripts"))
{
if (!(Test-Path "$Env:USERPROFILE\Documents\WindowsPowerShell"))
{
$rc = New-Item -Path "$Env:USERPROFILE\Documents\WindowsPowerShell" -ItemType directory
}
$rc = New-Item -Path "$Env:USERPROFILE\Documents\WindowsPowerShell\Transcripts" -ItemType directory
}
$curdate = $(get-date -Format "yyyyMMddhhmmss")
Start-Transcript -Path "$Env:USERPROFILE\Documents\WindowsPowerShell\Transcripts\PowerShell_transcript.$curdate.txt"
# Alias Git
#
New-Alias -Name git -Value "$Env:ProgramFiles\Git\bin\git.exe"
Alternatively, if you're already installed Git, then try to using Git Bash Terminal in VS Code.
Upvotes: 0