【问题标题】:I have a Terminal problem in vscode how do i fix我在 vscode 中遇到终端问题我该如何解决
【发布时间】:2022-06-10 23:42:55
【问题描述】:

我正在尝试上传一个 Github 项目并了解如何,所以我尝试了一个视频,但结果是:

即:

PS C:\Users\BRQL\Documents\Github vscode> git.init
git.init: The term 'git.init' 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.init
+
+~~~~~~~~~~
+ Category Info
~
: ObjectNotFound: (git.init:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException

【问题讨论】:

标签: github visual-studio-code terminal command


【解决方案1】:

正确的命令是git init .,而不是git.init

git 无法识别后一种语法。


注意最好是git init .,意思是在当前本地文件夹中为一个project文件夹初始化一个新的Git仓库。

您当前的文件夹是Github vscode(来自C:\Users\BRQL\Documents\Github vscode)。
除非您的项目是自己开发 VSCode,否则最好提供一个实际的项目名称(例如,“myProject”),然后键入:

git init myProject

这将创建一个C:\Users\BRQL\Documents\Github vscode\myProject,您可以在其中开始添加/提交文件。


作为替代方案,您还可以使用(对于链接到 GitHub 存储库的本地项目)GitHub CLI gh 命令(在 installationauthentication 之后)。
具体:gh repo create

mkdir myProject
cd myProject
# create a new remote repository and clone it locally
gh repo create myProject --public --clone

【讨论】:

    【解决方案2】:

    你需要先安装git 你可以从https://git-scm.com/downloads下载 和

    git .init
    

    不是 git 命令。

    git 初始化命令是

    git init
    

    你可以从http://guides.beanstalkapp.com/version-control/common-git-commands.html查看git的其他commants

    【讨论】:

      【解决方案3】:

      对于初学者来说,在本地机器上运行一个新的 Github 项目的最简单方法是先在 Github 上创建它,然后使用 clone 存储库

      git clone url-of-repo
      

      然后,您将在子目录中获得一个工作存储库副本,其中包含项目名称(在创建时给出)。

      【讨论】:

        猜你喜欢
        • 2021-12-22
        • 1970-01-01
        • 2016-03-08
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-11-02
        • 2020-08-21
        • 1970-01-01
        相关资源
        最近更新 更多