Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

man command not found on git bash #249

Closed
emilydolson opened this issue Nov 20, 2015 · 25 comments
Closed

man command not found on git bash #249

emilydolson opened this issue Nov 20, 2015 · 25 comments

Comments

@emilydolson
Copy link
Contributor

man doesn't seem to be installed on git bash - learners get a "man: command not found" error when they try to use it.

@jiffyclub
Copy link

Yup, no man with Git Bash. I try to remember to note this for students and tell them about <command> --help instead.

@emilydolson
Copy link
Contributor Author

Ah, okay. So there's no fix?

@jiffyclub
Copy link

Not that I know of.

@elliotpryde
Copy link

elliotpryde commented Dec 6, 2017

As a workaround, I've installed TLDR pages and set it as the default keyword search tool with :set keywordprg=tldr. Thought I'd add my solution here since this is one of the first google results.

@MichaelJGW
Copy link

I add this to my .bash_profile
man(){ $1 --help }

@BJWiley233
Copy link

BJWiley233 commented Apr 11, 2018

so you need to add the semicolon after the function like below
man(){ $1 --help; }

@umnikos
Copy link

umnikos commented May 2, 2018

There's no gets --help but there's man gets. Man is more than just help for your bash commands

@freddyouellette
Copy link

Does anyone know a way to manually install man pages into git bash? man obviously comes with a lot more than just --help. Just look at the man pages for ssh or scp in comparison to what --help gives you...

@rgaiacs
Copy link
Contributor

rgaiacs commented Aug 21, 2018

Does anyone know a way to manually install man pages into git bash?

Not out of the box. If you really need man you might want to install https://www.cygwin.com/.

@AmanL04
Copy link

AmanL04 commented Jan 21, 2019

As a workaround, I've installed TLDR pages and set it as the default keyword search tool with :set keywordprg=tldr. Thought I'd add my solution here since this is one of the first google results.

Hey thanks man. This worked like a charm.

@ernstki
Copy link
Contributor

ernstki commented Feb 24, 2019

It's also possible to use the regular MSYS2 installer, install git, nano, and man-pages-posix using pacman, and you'll have roughly the same setup as Git for Windows (which is based on MSYS2 anyway), except you'll have the real man pages, and the ability to install other packages when you need them.

pacman -S git nano man-pages-posix

(admittedly, not the best solution for a classroom full of people learning to use the command line for the first time)

If you're using Git a lot and don't like typing in passwords to push and pull from remotes, this is a minor step backward, because you probably won't get the Git for Windows credential manager, or its integration with your system certificate store.

@Irfan434
Copy link

Use --help. If you keep typing man out of habit, like me, paste this into the shell:

cat << EOF >> ~/.bashrc
myMan(){
        \$1 --help | less
}

# if man command not found, alias to myMan
man 2>/dev/null
if [ \$? -eq 127 ]
then
        alias man=myMan
fi
EOF

@ernstki
Copy link
Contributor

ernstki commented Jun 13, 2019

A lot of these solutions are clever, but, if we're being honest with ourselves, they aren't going to help the "learners," as the original issue states, because the root of the problem is that Git Bash is not "real Unix."

@elliotpryde's suggestion is great, but honestly which student just going through these course materials for the first time is going to be using Vim, know that you can do man page lookups within it (with K in normal mode), or even recognize that that magic command needs to go in your ~/.vimrc? (Elliot, you might want to update your comment to make that clear...)

And that's sad, because man pages are one of the great things about a Unix environment, and it's a shame to have to go, "oh, psych, that doesn't work for you, because you have Git Bash," to which the inevitable response is "What's Git? I thought this was Unix?"

The Software Carpentry course materials do, if I recall, mention that you might need to use --help instead on Windows, might (or should) note that there's a help command for Bash built-ins, and might even suggest using an online reference like https://linux.die.net. But as @umnikos points out, that's not a proper substitute for being able to do man command right in the shell. At all.

Thing is, Git Bash is still the best thing going on Windows, for first-time learners, because MSYS2 and Cygwin are not complete solutions unless you know which packages to install. (I know, I know, there's a Linux subsystem you can enable in Windows 10, but... baby steps.) So I think I'll try to raise the issue with the Git Bash folks and see what they say. I'll report back. ;)

@swaldman3
Copy link

This is gonna become moot in a couple of years - once Windows 7 leaves supported status, and hence everybody is hopefully on 10, there's no longer a reason to use git bash rather than Win10's built-in Ubuntu support :-)

@ernstki
Copy link
Contributor

ernstki commented Jul 15, 2019

@swaldman3 Does this feature really ship with Windows 10 though? As of this writing, it looks like you have to sign up for some "Windows Insider" program to get access, probably have to wait for an update to download, then find the "developer mode" switch buried in the control panel and switch that on. And of course reboot. Also, who knows whether the "Home" version of Windows 10 will even have this capability.

For workshops, maybe still not as straightforward as "here, download this free program from this web site (no signup required) and install it, then click on this icon in the Start menu."

@swaldman3
Copy link

swaldman3 commented Jul 15, 2019

Yes, it really ships with Windows 10, including Home editions. Has done for a couple of years now. The only question mark in my mind is at the other end of the scale, with heavily locked down Enterprise installs - but they'd probably have trouble installing git bash too.

You don't have to sign up for anything. You have to enable the "Windows subsystem for linux", and then install your chosen distro through the Microsoft Store, but these are not substantially harder to follow instructions for than installing git bash - there are probably fewer options to choose - and then you end up with a (to our intents and purposes) fully functional linux distro and none of the usual weirdnesses of no man, different line endings, etc.

@ernstki
Copy link
Contributor

ernstki commented Jul 15, 2019

Ah. Well I'll be.

@AustinTSchaffer
Copy link

@swaldman3

then you end up with a (to our intents and purposes) fully functional linux distro and none of the usual weirdnesses of no man, different line endings, etc.

I'm still waiting for MS to mainline WSL2 before I suggest people try out WSL. With WSL you get to actually live in a *nix environment which eliminates some weirdness, but WSL(1) has its own weirdness regarding significantly slower file system IO, due to how it was implemented.

microsoft/WSL#981

microsoft/WSL#873

@Kimber720
Copy link

As mentioned before...this does NOT in any way help a total newbie trying to get through learning at a camp on a MS product.

@ernstki
Copy link
Contributor

ernstki commented Jan 4, 2020

Just to follow up on something I said I'd check into: It seems unlikely that Git for Windows (which provides Git Bash) will ever include the manual pages, based on the discussion in git-for-windows/git#696.

I don't think it's a completely foregone conclusion, I just think that the maintainer himself doesn't see it as a priority, so it's unlikely to happen unless somebody (you? me?) does it for him and submits a pull request.

@ajanac
Copy link

ajanac commented Jun 6, 2020

command_name --help worked for me 👍

@hanisntsolo
Copy link

Yup, no man with Git Bash. I try to remember to note this for students and tell them about <command> --help instead.

Thank you so much, brother

@PantheraRed
Copy link

I'm pretty sure you can simply install man by typing apt install man in terminal (ubuntu).

@swaldman3
Copy link

I'm pretty sure you can simply install man by typing apt install man in terminal (ubuntu).

git bash is something used by classes to have a limited linux shell, and CLI access to git, in windows.

@Kolotokon
Copy link

Kolotokon commented Oct 2, 2020

Эта команда в Git Bach ответить на ваш вопрос ! Какой командой можно посмотреть параметры и ключи в git bash .
$ ls --help

@swcarpentry swcarpentry locked as resolved and limited conversation to collaborators Oct 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests