DebugFactor.com | Forum

Download file from GIT using wget

I am unable to download file from GIT using wget in linux server. The file size and contents looks different.

I am using the below command.

wget https://github.com/location/file.tar.gz

Please advice.

You can download by using the url of the raw file.
To get the url, click on the specific file in github, then click on View Raw and copy the URL. If you are unable to click on the View Raw, then right click on View Raw button and copy the link. It will look similar to the below.

wget https://github.com/location/file.tar.gz?raw=true 

The above command will download the file, but the filename will be file.tar.gz?raw=true . To change the name of the file during download, use the below command.

wget https://github.com/location/file.tar.gz?raw=true -O file.tar.gz

Further, if you need to download it to a particular location, you can use the below command.

wget https://github.com/location/file.tar.gz?raw=true -O file.tar.gz -P /tmp/folder/

Hope this helps!