- golang “go get” command showing “go: missing Git command” error
- 5 Answers 5
- Locally
- In Docker
- Not the answer you’re looking for? Browse other questions tagged go or ask your own question.
- Linked
- Related
- Hot Network Questions
- Subscribe to RSS
- Today I Learned — Fix: go get private repository return error terminal prompts disabled
- Fixing fatal: could not read Username for ‘https://githost[.]something’: terminal prompts disabled
- Fixing fatal: could not read Username for Gitlab: terminal prompts disabled
- Fixing fatal: could not read Username for Bitbucket: terminal prompts disabled
- Credential Manager Core not a git command. See git —help . #144
- Comments
- javaniecampbell commented Jul 2, 2020
- dscho commented Jul 3, 2020
- scivision commented Jul 7, 2020 •
- mjcheetham commented Jul 7, 2020
- scivision commented Jul 8, 2020
- mjcheetham commented Jul 17, 2020
- git: ‘remote-ttps’ is not a git command
- 2 Answers 2
- ‘git’ не распознается как внутренняя или внешняя команда
- 20 ответов:
golang “go get” command showing “go: missing Git command” error
I’m new in go lang. Trying to import a go library using «go get» command but in cmd getting this error:
My Go Env:
What’s wrong with my Go environment?
5 Answers 5
go get requires git if any of the packages lives (and is being fetched) from a git repository. For Windows, you can install git from the git website.
Locally
Installing git will solve the issue.
- for mac brew install git
- for ubuntu sudo apt-get install git
- for arch linux pacman -S git
- for windows install git according to the instructions from the git installation page .
In Docker
If you are getting while running in building docker image then you should install git there. [I got this issue while building docker image]
For Example: In my Dockerfile
The go get fetching of source code is done by using one of the following tools expected to be found on your system either git, svn, hg.
After installing git you should navigate to the environment variables setting and add the path of git.exe(executable file) which is found in the bin. So the path should look like this «C:\Program Files\Git\bin». Restart your IDE and the command should be working.
for Ubuntu, you can use the command
If you’re running this as a Jenkins pipeline script, start your Docker image like:
Not the answer you’re looking for? Browse other questions tagged go or ask your own question.
Linked
Related
Hot Network Questions
Subscribe to RSS
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.4.16.39093
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
Today I Learned — Fix: go get private repository return error terminal prompts disabled
Fixing fatal: could not read Username for ‘https://githost[.]something’: terminal prompts disabled
I’ve some project stored separated into 3 git-host providers: Github, Gitlab, and Bitbucket. Because I was a low-profile software engineer, I use both in Gitlab and Bitbucket for the private repository and Github for public repository XD.
I like Github very much, but my current financial status forced me to reduce any not so important cost just for my personal hobby and private projects XD.
So, a few days ago, I’m trying to create a project of Golang and stored it in Gitlab. And this project has 2 dependencies to my other library. One of them stored in Bitbucket, and another one in Gitlab.
To simplify, I will tell it in an example. Let’s say I have 3 projects.
- math library project in bitbucket (private repository)
- multiply library project in Gitlab (private repository)
- samplecool project in Gitlab(private repository)
So, the samplecool project use the math and the multiply as its dependencies, means, the math and multiply is imported in samplecool project.
And when I trying to go get the samplecool ‘s dependencies, this error happens:
If we look for more detail, the errors I found is:
I see a similar error happened here. After finding the solution on the internet, I found a few commands that help me to solve this.
Fixing fatal: could not read Username for Gitlab: terminal prompts disabled
For Gitlab case, This command should fix this error ( copy this to the terminal)
This will use our /.ssh , so make sure our ssh key exists and registered in our Gitlab.
To ensure this command works, when we see in .gitconfig there will be an addition to the .gitconfig something like this:
Fixing fatal: could not read Username for Bitbucket: terminal prompts disabled
The same goes for bitbucket.
And my .gitconfig will change into like this below:
After doing this in both Gitlab and Bitbucket, now I can go get all the dependencies.
And this also works for Github too. If you try to GitHub, just change the URL target and URL origin.
Credential Manager Core not a git command. See git —help . #144
Comments
javaniecampbell commented Jul 2, 2020
Which version of GCM Core are you using?
From a terminal, run git-credential-manager-core version and paste the output.
Git Credential Manager version 2.0.164-beta+1264f234c7 (Windows, .NET Framework 4.0.30319.42000)
Which Git host provider are you trying to connect to?
- Azure DevOps
- Azure DevOps Server (TFS/on-prem)
- GitHub
- GitHub Enterprise
- Bitbucket
- Other — please describe
Can you access the remote repository directly in the browser using the remote URL?
From a terminal, run git remote -v to see your remote URL.
- Yes — as long as I am signed to my GitHub a/c as it is a private repo
- No, I get a permission error
- No, for a different reason — please describe
[Azure DevOps only] What format is your remote URL?
[Azure DevOps only] If the account picker shows more than one identity as you authenticate, check that you selected the same one that has access on the web.
- Not applicable
- I only see one identity
- I checked each identity and none worked
Expected behavior
I am authenticated and my Git operation completes successfully.
Actual behavior
After attempting to do a git operation e.g. git pull it threw an error as shown below:
Logs
Set the environment variables GCM_TRACE=1 and GIT_TRACE=1 and re-run your Git command. Review and redact any private information and attach the log.
The text was updated successfully, but these errors were encountered:
dscho commented Jul 3, 2020
This sounds as if GCM Core was not installed correctly into your Git’s libexec path. What does git —exec-path show? Do you see git-credential-manager-core.exe in that folder? If not, can you find where it was installed instead?
scivision commented Jul 7, 2020 •
I have the same error on my system:
- C:/Program Files/Git/mingw64/libexec/git-core/git.exe
- C:\Program Files (x86)\Git Credential Manager Core\git-credential-manager-core.exe
The installer added to my
I made a softlink for git-credential-manager-core.exe to the libexec directory where git.exe is. Then a git push results in error
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly ‘Microsoft.Git.CredentialManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null’ or one of its dependencies. The system cannot find the file specified.
at Microsoft.Git.CredentialManager.Program.Main(String[] args)
I then uninstalled this program and went back to GCM 1.20 (which did work and now still works), which puts in
/.gitconfig, and is installed in the same directory above as git.exe:
mjcheetham commented Jul 7, 2020
Can you please check if C:\Program Files (x86)\Git Credential Manager Core has been added to your %PATH% ?
The .exe installer should do this for you. You may need to close your current command prompt window and open a new one to get the updated environment variables.
scivision commented Jul 8, 2020
Yes it was, I forgot that Windows Terminal needs to be completely closed (all tabs) to update PATH in a new tab. So that was it, close/open Windows Terminal and GCM Core works. Thanks!
mjcheetham commented Jul 17, 2020
Glad to hear you got things working! 🥳 Please let us know if you encounter any issues with GCM Core, and thanks again for trying GCM Core out.
FWIW we’re updating the %PATH% via Environment.SetEnvironmentVariable(. ) .
Lines 148 to 162 in c763ca0
// NOTE: We currently only update the PATH in Windows installations and leave putting the GCM executable |
// on the PATH on other platform to their installers. |
if ( PlatformUtils . IsWindows ()) |
< |
string directoryPath = Path . GetDirectoryName ( _appPath ); |
if ( ! environment . IsDirectoryOnPath ( directoryPath )) |
< |
Context . Trace . WriteLine ( » Adding application to PATH. » ); |
environment . AddDirectoryToPath ( directoryPath , environmentTarget ); |
> |
else |
< |
Context . Trace . WriteLine ( » Application is already on the PATH. » ); |
> |
> |
Lines 25 to 46 in a71aee7
public override void AddDirectoryToPath ( string directoryPath , EnvironmentVariableTarget target ) |
< |
// Read the current PATH variable, not the cached one |
string currentValue = Environment . GetEnvironmentVariable ( » PATH » , target ) ?? string . Empty ; |
// Append directory to the end |
var sb = new StringBuilder (); |
sb . Append ( currentValue ); |
if ( ! currentValue . EndsWith ( » ; » )) |
< |
sb . Append ( ‘;’ ); |
> |
sb . Append ( directoryPath ); |
string newValue = sb . ToString (); |
// Update the real system immediately |
Environment . SetEnvironmentVariable ( » PATH » , newValue , target ); |
// Update the cached PATH variable to the latest value (as well as all other variables) |
Variables = GetCurrentVariables (); |
> |
..which, according to documentation here:
If target is EnvironmentVariableTarget.User, the environment variable is stored in the HKEY_CURRENT_USER\Environment key of the local computer’s registry. It is also copied to instances of File Explorer that are running as the current user. The environment variable is then inherited by any new processes that the user launches from File Explorer.
Similarly, if target is EnvironmentVariableTarget.Machine, the environment variable is stored in the HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment key of the local computer’s registry. It is also copied to all instances of File Explorer. The environment variable is then inherited by any new processes that are launched from File Explorer.
If target is User or Machine, other applications are notified of the set operation by a Windows WM_SETTINGCHANGE message.
If Windows Terminal listens to WM_SETTINGSCHANGE messages it should be able to reload the current user and machine environment.
git: ‘remote-ttps’ is not a git command
I am getting an error when I try to push my changes to remote branch, the complete error that I get is shown below —
I don’t remember what changes I did to the commands, but it looks misspelled.
I have also tried to look for this command available in git installation folder and its there as expected, here is the screenshot of it —
Could anyone please let me know where the mistake would have happened.
2 Answers 2
This unfortunate error message is an illustration of Git’s modularity: when it wants to connect to a remote server, it will invoke a helper command, named git-remote-
. So you’ll often see the HTTP-based transfer mechanism invoking git-remote-https .
You could even add your own remote transfer mechanism. I could create an executable named git-remote-ethomson and put it in my path. I could then invoke it by running git clone ethomson://my/repo.git . Git will parse that URL, note the scheme ethomson and go looking for a suitable remote helper in git-remote-ethomson .
It looks like what happened here is that you’ve mistyped a URL, and your remote’s URL is ttps://github.com/org/repo.git . (Note that this is ttps , not https .)
As a result of this configuration, git is looking for an executable to service that remote URL, as git-remote-ttps . Since that helper program doesn’t exist, it’s failing.
‘git’ не распознается как внутренняя или внешняя команда
когда я пытаюсь использовать git команда на моем обычном Windows cmd или cmd с ruby, я получаю следующую ошибку:
‘git’ не распознается как внутренняя или внешняя команда, исполняемой программой или пакетным файлом.
Как я могу исправить эту проблему?
20 ответов:
вы правильно установили свой путь, чтобы указать на вашу установку git?
вот как вы можете это сделать:
- Правой Кнопкой Мыши «Мой компьютер»,
- выберите «Свойства»,
- открыть «дополнительно»,
- нажмите кнопку «Переменные среды»,
- выделите переменную» Path»,
- нажмите кнопку «Редактировать»,
- добавьте свой конкретный путь перед полем «значение переменной», отделенным точкой с запятой от существующей записи. не добавляйте пробел; и последняя запись
вы открыли cmd подскажите перед установкой git? Если это так, закройте и снова откройте его.
- на Мой компьютер = > Локальный диск (C:) = > Program Files(x86) = > Git => cmd
- щелкните правой кнопкой мыши git = > выберите Свойства
- под расположение Скопировать текст например — C:\Program файлы (x86)\Git\cmd
- вернитесь на рабочий стол
- щелкните правой кнопкой мыши Мой Компьютер
- выберите свойства
- открыть Advanced
- клик Переменные Среды
- в системных переменных найдите вызов переменной путь
- выберите переменная
- выберите Редактировать
- выберите значение переменной Текстовое Поле .
- перейти к краю текста и поставить точка с запятой(;)
- щелкните правой кнопкой мыши и нажать вставить
- Нажмите Ok
Если вы установили git для window (http://windows.github.com/), Затем найдите git.exe в диске» C». это будет что-то вроде
добавить в переменные среды окна, как сказано выше
простой маршрут, чтобы избежать возиться с переменными пути: переустановите git и выберите «использовать Git из командной строки Windows». Он будет принимать переменные пути для вас, как уже упоминалось. смотрите скриншот
Если вы хотите настроить для временной цели, просто выполните команду ниже.
- открыть командную строку cmd>
- выполнить следующую команду.
set PATH=C:\Program Files\Git\bin;%PATH% - тип git, он будет работать.
Это действительно только для текущего окна / ячейки, если вы закроете командную строку, все будет исчезать. для постоянной настройки установите GIT в среде переменная.
а. нажмите окно+пауза
b. нажмите на предварительную настройку системы.
c. нажмите на переменную окружения на вкладке Advance.
д’. Отредактировать Переменную PATH.
e. добавить строку ниже в конце инструкции.
;c:\Program Files\Git\bin;
f. нажмите OK!!
г. Откройте новое окно командной строки .
ч. Типа git и нажимаем Enter
Пуск — > Все Программы — >Git — >Git Bash
приведет вас непосредственно к оболочке Git.
Git должен быть настроен в переменных пути.
(на Windows 7) Откройте кнопку Пуск и введите environment . Нажмите на Edit the system environment variables . Нажмите Environment Variables . Прокрутите вниз до Path переменная в нижней части окна по имени system variables . Нажмите edit . В нижнем поле с именем variable value добавьте путь к папке git bin. (для меня это C:\Program Files (x86)\Git\bin но это может быть по-другому для вас.) Если нет точки с запятой ( ; ) между вашим путем и предыдущим, добавьте один там. Убедитесь, что вы не удаляйте другие переменные пути, только добавьте папку git bin в конец.
это работает для меня. Git теперь доступен через командную строку. Откройте командную строку и введите git чтобы проверить, если он работал для вас.
- перетащите курсор мыши в правый нижний угол экрана
- нажмите на значок поиска и введите: Панель управления
- нажмите на — > панель управления — > Система — > Дополнительно
- нажмите на переменные среды, в разделе системные переменные, найдите путь и нажмите на него.
C:\Program файлы (x86)\Git\bin;C:\Program файлы (x86)\Git\cmd
Это сработало для меня
Йоу! У меня было много проблем с этим. Похоже, что Github приносит свою собственную консоль, которую вам нужно искать в вашем диске. Мне удалось, наконец, запустить его следующим образом:
- Нажмите Кнопку Старт.
- Поиск «GitHub «(без кавычек)
- щелкните правой кнопкой мыши на «GitHub «и выберите»Открыть расположение файла»
здесь имя пользователя это ваш компьютер имя пользователя
- найдите программу под названием «Git Shell». Дважды щелкните по нему.
откроется командная строка PowerShell. Затем вы можете запустить свои команды git нормально на нем.
Это потому, что во время установки вы выбрали переключатель по умолчанию, чтобы использовать «git» только с «Git bash». Если бы вы выбрали «Git и инструмент командной строки», то это не было бы проблемой.
- Решение#1: поскольку вы уже установили git tool, Теперь перейдите в нужную папку, а затем щелкните правой кнопкой мыши и используйте «git bash here», чтобы запустить ту же команду, и она будет работать правильно.
- решение#2: повторите попытку установки git-scm и выберите правильный выбор.
просто хотел добавить к ответу Абизерн. Если кто-то использует учетную запись без администратора, вы можете создать «локальную» переменную вместо «системной» переменной, которая позволяет получить доступ к стандартным/ограниченным учетным записям.
когда в окне» Переменные среды»:
1) Выберите «Новая. кнопка «внутри» пользовательских переменных for . » раздел.
2) Установите «имя переменной:» как «путь» и » значение переменной: «как» [ваш-git-путь] «(обычно находится по адресу C:\Program Files (x86)\Git\bin ).
3) затем нажмите кнопку ОК.
в Windows используйте msysgit чтобы получить приглашение bash с командой git.
- Правой Кнопкой Мыши «Мой компьютер»,
- выберите «Свойства»,
- открыть «дополнительно»,
- нажмите кнопку «Переменные среды»,
- выделите переменную» Path»,
- нажмите кнопку «Изменить», добавьте каталоги в путь.
Если вы установили git 64bit, без изменений в папке установки по умолчанию, git будет в
C:\Program Files\Git\bin;C:\Program Files\Git\cmd- измените путь с вашим точным путем к git
- клик ЛАДНО.
если вы не знаете, где находится ваша папка Git: в windows 7/8/10 git должен быть найден:
— C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Git\cmd
— C:\Program Files\Git\bin;C:\Program Files\Git\cmd
закройте командную строку и выйдите. Затем снова откройте командную строку.
Я установил Git и попытался использовать командную строку в разделе Действия в Team explorer/Changes.
добавить путь в переменные среды
Примечание: путь может отличаться, но вы должны добавить как bin и cmd
после установки откройте приложение GitHub и в правом верхнем углу вы заметите значок Настройки. Выберите Параметры из выпадающего списка и выберите «оболочка по умолчанию» в качестве Cmd.
теперь попробуйте ввести «git shell» в поиске (ключ и тип windows) и выберите Git Shell. Он должен открыться в CMD, и теперь git должен быть распознан.
попробуйте запустить окно командной строки от имени администратора. Тип:
вы должны получить ответ, что-то вроде «git версии 2.17.1.окна.2».
Если вы получаете что-то похожее на ответ выше, попробуйте запустить окно Git Bash от имени администратора.
теперь вы должны увидеть, что вы вошли в оболочку Git Bash с помощью цветной текст и все.
мой не будет работать, несмотря ни на что, пока я не буду использовать оболочку Git bash в качестве администратора. Просто хотел поделиться, если кто-то еще столкнется с подобной проблемой.
Это помогает мне : Я C:\Program файлы (x86)\Git\bin;C:\Program файлы (x86)\Git\cmd в пути для переменной среды.
Я использую git для моего приложения Ruby on Rails. Первый раз так.
(The .bat файл для редактирования использование notepad++ следовательно, нет необходимости в длительном процессе всякий раз, когда вам нужно отредактировать путь, вы можете следовать этим простым процессом после создания .bat-файл, следующий за учебниками по ссылке выше » файл называется row.летучая мышь.»)
- щелкните правой кнопкой мыши на .файл bat,
- редактировать с помощью Notepad++.
- найти путь.
вставить путь ниже последнего введенного пути.
)
Во время уроков я не помню ничего, что было сказано в что касается использования команды git, поэтому при запуске нового проекта у меня была такая же проблема после установки git. Основная проблема, с которой я столкнулся, заключалась в поиске папки с bin/git.exe (git.exe не появился в поиске с помощью меню «Поиск программ и файлов» в меню «Пуск») Примечание теперь я понял, что расположение может сильно отличаться — см. ниже.
чтобы найти bin / git.exe я следовал этим шагам
1 щелкните левой кнопкой мыши меню «Пуск» и найдите ->> все программы ->> GitHub inc. 2 щелкните правой кнопкой мыши оболочку git и выберите Открыть расположение файла 3 щелкните по папкам в папке в папку «bin»
(У меня было 4 папки с именами 1. IgnoreTemplates_fdbf2020839cde135ff9dbed7d503f8e03fa3ab4 2. ОРС-x86_0.5.1 3. PortableGit_c2ba306e536fdf878271f7fe636a147ff37326ad («bin / exe, найдено здесь
скопируйте полную ссылку, нажав на url исследователей (мой был «C:\Users\username\AppData\Local\GitHub\PortableGit_c2ba306e536fdf878271f7fe636a147ff37326ad\bin») открыть .bat файл в notepad++ и вставить с помощью инструкции о том, как добавить путь к вашему .bat-файл из учебников выше. Проблема решена!