简体   繁体   English

无法将原点添加到新的git存储库

[英]Cannot add origin to my new git repository

I have created a git repository and want to add some code files to it. 我创建了一个git存储库,并想向其中添加一些代码文件。 I'm using git bash of Windows version. 我正在使用Windows版本的git bash。 I ran these lines 我跑了这些线

    git init

    git status

This showed all files as none of them were tracked. 这显示了所有文件,因为没有文件被跟踪。 Then 然后

    git add .
    git commit "my_commit"

    git remote add origin https://github.com/userName/FileName.git

By running this command, got the following error 通过运行此命令,得到以下错误

    bash: $'\302\226git': command not found

I have checked the path by running in cmd 我已经通过在cmd中运行检查了路径

    git --version

That resulted: 结果是:

    git version 2.20.1.windows.1

You have a strange character between the command prompt and the git command. 您在命令提示符和git命令之间有一个奇怪的字符。 Remove it either moving the cursor to the g of git and hitting backspace several times, or yo can also: 删除它,或者将光标移动到gitg并按退格键几次,或者也可以:

  1. Activate vi mode (supposing you are working with git bash ): set -o vi 激活vi mode (假设您正在使用git bash ): set -o vi
  2. Once you have your command on screen, press Esc and the v key. 屏幕上显示命令后,按Escv键。 A vi screen will open letting you edit the command. 将打开一个vi屏幕,供您编辑命令。
  3. Edit the command removing this character(s) and save with :wq . 编辑删除该字符的命令,然后使用:wq保存。 The command should execute normally. 该命令应正常执行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM