我正在尝试将我的React应用程序上传到GitHub仓库,但是Visual Studio Code无法识别Git命令。
我在电脑上安装了Git。 Git的路径是正确的,我已经多次检查过。我通过Visual Studio Code终端安装了GitHub Pages。我还向文件package.json添加了必要的更改。现在当我在Visual Studio Code终端中运行git init
时,它会抛出一个错误,指出“git”不是一个可识别的命令。这是为什么,我该如何解决?
这是Visual Studio Code中Git路径的设置- "git.path":"C:/Program Files/Git/bin/git.exe"。它是正确的。
Git Enabled也已经被勾选。
在package.json文件的第一个{}下进行修改:"homepage": "http://greardrear.github.io/messenger",并添加了以下内容:"predeploy": "npm run build", "deploy": "gh-pages -d build"。
当我尝试执行“git init”或“git remote add origin”时,我在Visual Studio Code终端中收到此消息:
git : The term 'git' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ git
+ ~~~
+ CategoryInfo : ObjectNotFound: (git:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
我该如何修复这个问题?
附:我尝试了所有可找到的“修复方法”,还尝试了更改路径为“git.path”:“C:/Program Files/Git/git-bash.exe”,但也没有解决问题。