wget command not found in git bash
Asked Answered
N

5

23

I've already tried pip install wget in my cmd, which reads

>pip install wget
Requirement already satisfied: wget in c:\users\user\...\python\python38-32\lib\site-packages (3.2)

however when I try the command in git bash, it keeps showing

$ wget
bash: wget: command not found

I've made sure both the python file and the git file are in PATH.

What am I doing wrong here?

Noisome answered 5/7, 2020 at 11:6 Comment(1)
Maybe time has come for you to try Linux ;)Gerlach
G
13

With the command:

pip install wget

you installed this Python library https://pypi.org/project/wget/, so you can use that from inside Python:

import wget

I imagine what you actually want is to be able to use wget from inside Git bash. To do what, install Wget for Windows and add the executable to the path. Or, alternatively, use curl.

Guttapercha answered 5/7, 2020 at 11:12 Comment(0)
E
13

If you would like to use curl on Git Bash, here is an example:

$ curl -kLSs https://github.com/opscode/chef-repo/tarball/master -o master.tar.gz
  
$ ls master.tar.gz
master.tar.gz
  • -L follow redirects
  • -o (lower case O) to write output to file instead of stdout.
  • Ss silent mode, but show errors, if any
  • k allows curl to proceed and operate even for server connections otherwise considered insecure.

Reference: curl manpage.

Emulate answered 5/1, 2021 at 0:6 Comment(0)
D
8

if you are just looking for having wget in the git bash without pip or any other dependency, you can follow the nice and quick tutorial from this page:

How to add more to Git Bash on Windows

the essence of it is:

  1. Download wget binaries for Windows here (preferrably as ZIP) eternallybored
  2. extract the wget.exe from the zip
  3. copy the EXE file to your git bash binaries folder e.g. "c:\Program Files\Git\mingw64\bin"

done :)

Delmerdelmor answered 6/12, 2022 at 21:16 Comment(0)
G
0

i am using git bash for windows so i found it easier to just use curl than downloading wget

you can use it like that

curl -O https://example.com/somefile.zip

replace URL with the one you want download.

you can use "O" (capital) if you want the name you downloading without changing like above.

if you want change it you can use "o" (small) not capital like the following

curl -o TheFileNameHere https://example.com/somefile.zip

this will download the file from https://example.com/somefile.zip and name it TheFileNameHere change it as you want.

use curl --help to see more flags like -s if you want it silent not to see the downloading process. like

curl -s -O https://example.com/somefile.zip
Galicia answered 27/4 at 12:52 Comment(0)
E
-4

To have the wget command in the gitbash shell, Quick and dirty replacement for the single argument, fetch a file usecase:

alias wget='curl -O'

-O, --remote-name Write output to a file named as the remote file

Maybe give the alias a different name so you don't try to use wget flags in curl.

This has nothing to do with the shell package.

Exhilarate answered 7/9, 2021 at 19:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.