简体   繁体   English

git:'remote-https' 不是 git 命令?

[英]git: 'remote-https' is not a git command?

Whenever I attempt to clone, push or pull I get:每当我尝试克隆、推送或拉取时,我都会得到:

C:\Users\User\Documents\Project>git pull

git: 'remote-https' is not a git command. See 'git --help'.

Committing and adding still work fine.提交和添加仍然可以正常工作。

In my case, I was building Git from source in WSL Ubuntu.就我而言,我是在 WSL Ubuntu 中从源代码构建 Git。

The distribution didn't come with libcurl preinstalled.该发行版没有预装libcurl In this case, the git-remote-http executable was not being built.在这种情况下,没有构建git-remote-http可执行文件。 So I installed it:所以我安装了它:

sudo apt install libcurl4-openssl-dev

Then, I re-configured, re- make d and re-installed, and Git could clone.然后,我重新配置、重新make d 并重新安装,Git 可以克隆。

I was using Entware and had installed git using opkg install git and was getting this error.我正在使用 Entware 并使用opkg install git并收到此错误。 Installing git-http fixed it for me, ie opkg install git-http .安装git-http为我修复了它,即opkg install git-http This also helps on OpenWrt based systems.这也有助于基于 OpenWrt 的系统。

I was also having this error, and solved it by running this command:我也遇到了这个错误,并通过运行以下命令解决了它:

path %path%;C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\bin

This added the folder where my git-remote-https.exe file was stored.这添加了存储我的git-remote-https.exe文件的文件夹。

Today, I was facing the same problem.今天,我面临同样的问题。 The problem in my case was wrong path set in android studio to the git execution file.在我的情况下,问题是在 android studio 中为 git 执行文件设置了错误的路径。 I changed the path of git execution and it worked.我改变了 git 执行的路径,它起作用了。 According to my git installation the path was C:\Program Files\Git\mingw64\bin\git.exe .根据我的 git 安装,路径是C:\Program Files\Git\mingw64\bin\git.exe I used this path in android studio.我在android studio中使用了这个路径。 By using below steps通过使用以下步骤

  1. File文件
  2. Setting环境
  3. version control版本控制
  4. git And I pasted the above mentioned path in Path to git exectable git 我将上述路径粘贴到 git exectable 中

and done.并做了。

Hope this helps other.希望这对其他人有帮助。

I had the same error and I solved by installing the latest version of Git for Windows at https://gitforwindows.org/ .我遇到了同样的错误,我通过在https://gitforwindows.org/安装最新版本的 Windows 版 Git 解决了这个问题。 This might not be the correct solution for everyone.这可能不是每个人的正确解决方案。 I had recently uninstalled Git for Windows not realizing that my git GUI, SourceTree, was using it.我最近卸载了适用于 Windows 的 Git,但没有意识到我的 git GUI SourceTree 正在使用它。

Check the URL from .git/config file.检查.git/config文件中的URL

In my case, the error was the remote origin location就我而言,错误是远程源位置

[remote "origin"]
    url = "CHECK THIS LOCATION"

I guess the remote location is something like this and the unknown git command 'remote-https' came from an invalid combination of 'remote' + 'https'我猜远程位置是这样的,未知的 git 命令“remote-https”来自“remote”+“https”的无效组合

[remote "origin"]
    url = https://github.com/user/repo

I encountered the same thing with the git 2.18.0 or higher version.我在 git 2.18.0 或更高版本上遇到了同样的事情。 I downgraded to 2.17.* and it seems to solve the problem.我降级到 2.17.*,它似乎解决了这个问题。 My issue was running git clone through https.我的问题是通过 https 运行 git clone。

Note:笔记:

  • If after build and install git from the latest source code, this issue is occurred, continue..如果从最新的源代码构建并安装git后,出现此问题,请继续..
  • If not, just ignore this answer..如果没有,请忽略此答案..

Check the command git-remote-https existed or not in your git install path.检查git-remote-https命令是否存在于您的git安装路径中。 For me, after build from source and make install , I can check that by对我来说,在从源代码构建和make install之后,我可以通过

=---------------------=
│git on  HEAD (cd3e6062)
-> ls /usr/local/bin/git*

If that command not existed in path, copy the git-remote-https built from your git source code path to your git install path,如果该命令在路径中不存在,则将从您的 git 源代码路径构建的git-remote-https复制到您的git安装路径,

=---------------------=
│git on  HEAD (cd3e6062)
-> sudo cp git-remote-https /usr/local/bin

This points at an incomplete -- or otherwise busted -- installation.这表明安装不完整 - 或以其他方式破坏 - 安装。 Git is looking for -- and is unable to find -- one of its auxiliary executables: git-remote-https . Git 正在寻找——但无法找到——其辅助可执行文件之一: git-remote-https

If you used some sort of installer on Windows, try rerunning the installation... If you built it from source -- make sure to let the build process do the install itself, rather than manually copying git.exe (and omitting all the other binaries it needs).如果您在git.exe上使用了某种安装程序,尝试重新运行安装...它需要的二进制文件)。

I had the same issue, but mine was a bit different situation, when I added a git remote there was I typo in url's https part, so it would give me the same error, always go ahead and check your remote urls from cmd with git remote -v我有同样的问题,但我的情况有点不同,当我添加一个 git 远程时,我在 url 的 https 部分中输入了错误,所以它会给我同样的错误,总是提前 go 并检查来自 cmd 和 git 的远程 url远程-v

Make sure that the provided url is the same from Github.确保提供的 url 与 Github 相同。

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

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