When I type git add --patch on my Windows 10 machine in the terminal, I get the error:
git: 'add--interactive' is not a git command. See 'git --help'.
I've googled to no avail, all other problems seem to be people running into this issue using other software or on Linux. Any tips?
This thread (for Git on Linux) mentioned the lack of a git-perl package.
But that should not be the case on Windows.
For testing, download PortableGit-2.17.0-64-bit.7z.exe and uncompress its content anywhere you want.
Then setup a simplified PATH:
set G=c:\path\to\latest\git
set PATH=%G%\bin;%G%\usr\bin;%G%\mingw64\bin
set PATH=%PATH%;C:\windows\system32;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\
In that CMD session, try again your git add -p command.
Related
Overview:
Just installed the GIT version 2.20.1-64-bit on my Windows 7 platform. Git works well on GIT Bash; but, any git command on Windows CMD or Powershell raises The filename or extension is too long error.
Details:
GIT version: 2.20.1-64-bit
Platform: Windows 7
Troubleshooting Efforts:
I tried switching longpaths attribute to true based on Filename too long in Git for Windows. I also googled to find other solutions but all recommended the same approach which was updating the git config.
The GIT config file updated with git config --system core.longpaths true
Issue:
Any Git command via Windows CMD or 3rd party apps like IntelliJ Idea raises the following error:
CMD:
IntelliJ:
Please advise me with your genuine solutions.
I had the same problem. I then installed it in my user folder and now it works. It seems to be a privilege issue. Git gets installed as admin in C:\Program Files\Git but then can't write to these files because it is run as a user.
Also using the portable version should fix the problem.
Try first to use a simplified PATH and a portable Git (like PortableGit-2.20.1-64-bit.7z.exe) uncompressed anywhere you want.
set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\
set GH=C:\path\to\git
set PATH=%GH%\bin;%GH%\usr\bin;%GH%\mingw64\bin;%PATH%
Then check if the issue persists in that CMD session, where you have set said simplified PATH.
I am using a setup on Windows 10 x64 where I install and manage git via scoop, rather downloading and executing the installer myself. Via the PowerShell, I ran
scoop install git
scoop install openssh
[environment]::setenvironmentvariable('GIT_SSH', (resolve-path (scoop which ssh)), 'USER')
However, now when I try to run commands in the Git Bash like
git clone git#example.org:vendor/repository.git
or a simple
git push/pull
I only get
CreateProcessW failed error:193
ssh_askpass: posix_spawn: Unknown error
instead of the Git Bash asking me for my SSH key's passphrase.
I am using the same setup (git installed via scoop) on many other Windows 10 x64 and no problems occur there. So I am not sure what is going wrong on this one. I previously had git installed without scoop on the same machine and the Git Bash was working fine. I uninstalled git completely (and also restarted the machine, just to be sure) before re-installing it via scoop instead.
The SSH_ASKPASS environment variable contains the following, in case this is relevant:
$ echo ${SSH_ASKPASS}
/mingw64/libexec/git-core/git-gui--askpass
Not sure what that folder refers to (something internal to the Git Bash presumably?), since it obviously does not exist like that on my machine.
Update
When using git-with-openssh instead of just git and openssh separately it works. However, I don't use that on my other machines, so I'd still like to know why it's not working here.
I'm pretty sure my answer does not address the OP's original case. But as of 2020, there seems to be a similar issue with a different way of solving it, and that's how I did in my case.
Part of the problem is, now Windows 10 has its own version of OpenSSH available, and at least in the case of my work's machine it seems that option is enabled by default.
This bundled OpenSSH is not compatible with Git bash though, so if you wants to use it, you must force git use scoop's provided OpenSSH (either from openssh or git-with-openssh packages). That means overwriting GIT_SSH environment variable, e.g. by adding a line similar to this to your .bashrc:
export GIT_SSH='C:\Users\rogs\scoop\apps\git-with-openssh\current\usr\bin\ssh.exe'
Hope it helps.
Even if this topic is already very old, the problem persists. I found out that its enough to simply unset the environment variable to get rid of this error.
unset SSH_ASKPASS
Just put this in your .bash_profile and/or your .bashrc.
According to its doc, double-click should be enough. But when I opened git bash and ran git lfs init, it doesn't work:
$ git lfs init
git: 'lfs' is not a git command. See 'git --help'.
The only reason why "git lfs" would not be a git command would be because the git-lfs.exe hasn't been put in your %PATH%.
That is what the git-lfs-windows-amd64-0.5.3\install.bat is supposed to do.
set GIT_LFS_BIN_PATH="%LOCALAPPDATA%\GitLFS\bin"
IF EXIST %GIT_LFS_BIN_PATH% GOTO DIRECTORY_EXISTS
mkdir %GIT_LFS_BIN_PATH%
set "path=%PATH%;%GIT_LFS_BIN_PATH:"=%"
So:
Make sure install.bat was successfully executed
Check the content of "%LOCALAPPDATA%\GitLFS\bin"
make sure to open a new CMD Windows
Check your %PATH% environment variable
Just adding my 2c in case someone lands on this page..
The easiest (and I believe most "correct") option to install LFS on Windows is to use the windows' built-in winget package manager
winget install -e --id GitHub.GitLFS
I was getting the same error as you after simply running the downloaded installer, however the winget command fixed it for me.
PS. Even if you don't have winget - running winget will automatically install it from MS Store
I have installed gitolite on windows server using cygwin, installation steps went without problems and when I try to "ssh gitadmin#gitserver info" from local machine(windows) I get the correct response:
hello gitoliteAdmin, this is gitadmin#VRGWLSDEV1T running gitolite3 v3.6.1-6-gdc
8b590 on git 1.9.4.msysgit.0
R W gitolite-admin
R W testing
If I try to clone using Git Bash I get error:
$ git clone gitadmin#gitserver:gitolite-admin
Cloning into 'gitolite-admin'...
git: 'shell' is not a git command. See 'git --help'.
Did you mean this?
help
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
If I try to clone using cygwin terminal on local mashine (using the same ssh key and I get the same valid gitolite message) it returns:
$ git clone gitadmin#gitserver:gitolite-admin.git
Cloning into 'gitolite-admin'...
...and stays like that for enternity!
I have searched for multiple solutions, added PATH (with Git etc.) to .bashrc and .bash_profile files on gitolite designated server. Also added PATH to .gitolite.rc to include custom Git installation path (before that I did not recieve the gitolite message)
If you have any solution or idea what did I do wrong: please....HELP.
Resolved it by myself:
Mysis Git installation was confusing Cygwin. Added Git pack to Cygwin and removed Msys Git env. variables: everything woks perfectly now.
I am very new to the terminologies: git, repository and cloning.
I was able to search them all online and get pretty good grip on each (pretty simple stuff!).
But what I am trying to figure out now is how to "run" these instructions:
Clone repository for app:
git clone git://github.com/SampleLink.git
Update submodules:
git submodule update --init
I am running Windows7. I tried to run init through command prompt, but no luck.
Are these supposed to be run as individual commands or as one following the other in sequence automatically?
I am just not sure how to run these on my Windows machine and cannot seem to get any of it to work.
The submodule is a file within the initial repository.
I'm sorry if this is a lame question, but I have never needed to run this type of setup before.
I would recommend installing msysgit in its "Git for Windows" instance:
Git-1.7.3.1-preview20101002.exe
I like using Option 2, only adding the git\bin directory to the PATH environment variable, but without overriding some built-in windows tools.
From there, git clone over http should work.