Visual Studio代码:错误:Git无法执行

Luc*_*cas 7 git visual-studio-code

我安装了VS Code(版本:1.12.1),之后我在Windows 10机器上安装了Git(版本:2.13.0.windows.1).然后:

  1. 我创建了一个Asp.Net项目(img 1)

  2. 我在VS Code中打开它,转到Source Control并单击Initialize Repository(img 2)

  3. 我试图提交更改(img 3).

  4. 我看到了这条错误消息(img 4).
  5. 然后我确保git是提供者(img 5)
  6. 我去了settings.json并覆盖了git Path(img 6),默认情况下它被设置为null.但它并没有解决问题.我从头开始创建另一个应用程序,并显示相同的错误消息.

请点击此处查看截图

这是Git Log输出:

Using git 2.13.0.windows.1 from C:\Program Files\Git\cmd\git.exe
git rev-parse --show-toplevel
git rev-parse --show-toplevel
fatal: Not a git repository (or any of the parent directories): .git

fatal: Not a git repository (or any of the parent directories): .git

fatal: Not a git repository (or any of the parent directories): .git

git rev-parse --show-toplevel
fatal: Not a git repository (or any of the parent directories): .git

git init
git rev-parse --show-toplevel
git status -z -u
git symbolic-ref --short HEAD
git rev-parse master
fatal: ambiguous argument 'master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

git for-each-ref --format %(refname) %(objectname)
git remote --verbose
git show :../../AppData/Roaming/Code/User/settings.json
git status -z -u
git symbolic-ref --short HEAD
git rev-parse master
fatal: ambiguous argument 'master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

git for-each-ref --format %(refname) %(objectname)
git remote --verbose
git show :../../AppData/Roaming/Code/User/settings.json
git add -A -- .
git commit --quiet --allow-empty-message --file - --all

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'COMPAQ@PREPARA12.(none)')

git config --get-all user.name
git show :../../AppData/Roaming/Code/User/settings.json
git status -z -u
git symbolic-ref --short HEAD
git rev-parse master
fatal: ambiguous argument 'master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

git for-each-ref --format %(refname) %(objectname)
git remote --verbose
git show :../../AppData/Roaming/Code/User/settings.json
git commit --quiet --allow-empty-message --file -

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'COMPAQ@PREPARA12.(none)')

git config --get-all user.name
git show :../../AppData/Roaming/Code/User/settings.json
git status -z -u
git symbolic-ref --short HEAD
git rev-parse master
fatal: ambiguous argument 'master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

git for-each-ref --format %(refname) %(objectname)
git remote --verbose
git show :../../AppData/Roaming/Code/User/settings.json
git fetch
fatal: No remote repository specified.  Please, specify either a URL or a
remote name from which new revisions should be fetched.

git fetch
fatal: No remote repository specified.  Please, specify either a URL or a
remote name from which new revisions should be fetched.

git fetch
fatal: No remote repository specified.  Please, specify either a URL or a
remote name from which new revisions should be fetched.

git fetch
fatal: No remote repository specified.  Please, specify either a URL or a
remote name from which new revisions should be fetched.

git fetch
fatal: No remote repository specified.  Please, specify either a URL or a
remote name from which new revisions should be fetched.

git commit --quiet --allow-empty-message --file -

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'COMPAQ@PREPARA12.(none)')

git config --get-all user.name
git status -z -u
git symbolic-ref --short HEAD
git rev-parse master
fatal: ambiguous argument 'master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

git for-each-ref --format %(refname) %(objectname)
git remote --verbose
Run Code Online (Sandbox Code Playgroud)

The*_*ver 1

从上面的评论来看:

读取 Git 的日志输出。配置您的用户电子邮件和用户名。一种方法是打开命令提示符。然后使用 导航到您的文件夹cd FILEPATH。然后配置您的用户电子邮件和用户名。它可以全局配置或仅在当前存储库内配置。全局配置为

git config --global user.email "youremailaddress@example.com"
Run Code Online (Sandbox Code Playgroud)

然后

git config --global user.name "Your Name"
Run Code Online (Sandbox Code Playgroud)