【问题标题】:Visual Studio Code Terminal "git add . " sends following error message "fatal: not a git repository (or any of the parent directories): .git"Visual Studio 代码终端“git add .”发送以下错误消息“致命:不是 git 存储库(或任何父目录):.git”
【发布时间】:2020-02-04 02:05:27
【问题描述】:

我有一个项目,我想使用终端和命令从 Visual Studio Code 上传:

git add .

请参阅下面的错误消息。

致命:不是 git 存储库(或任何父目录):.git

我不明白如何解决这个问题。

【问题讨论】:

  • 要将文件添加到 git repo,您​​需要有一个。你为你的项目做过一个吗?你在那个目录吗?如果您没有,则需要初始化一个(新的)或克隆一个(现有项目)

标签: git git-add


【解决方案1】:

此错误消息表明您尚未启动 git 存储库,或者您正在尝试从错误的路径暂存文件。在您的终端中,转到该目录并再次尝试暂存文件。它应该按预期工作。

【讨论】:

  • 非常感谢您的帮助!!非常感谢!
【解决方案2】:

错误消息表明您没有 git 存储库。你需要做一个,然后你可以提交更改,并将其推送到远程:

<in the root directory of the project>
git init
git add <files to add>
git commit
git remote add origin <url for remote>
git push --set-upstream origin master

您可以从您的 git 主机提供商处获取远程的 url。你在那里创建一个项目/存储库,它会给你 git URL。

【讨论】:

  • 一百万!!!对于我的新项目,我做得正确:-)
猜你喜欢
  • 2019-10-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-12-12
  • 2013-12-23
  • 2012-06-30
相关资源
最近更新 更多