Search code examples
bashgitbitbucketwget

Wget raw file from bitbucket and get the latest version without Commit-SHA number in the wget link


I try to download an installscript shell file which I host on BitBucket.

currently im using following command:

wget https://bitbucket.org/projectname/reponame/raw/commit-sha-num/installscript.sh

Later I want to have the possibility to modify my installscript.sh and want that the latest version is downloaded instead of a specific checkout with the commit-sha-number.

Im aware that it could be possible with git clone, but wget would be here more convenient for me if it was possible.

Is there a way to download everytime the latest version of this file from my master branch?

Thanks in advance


Solution

  • Yes. You can use the 'HEAD' keyword in the URL instead of the 'commit-sha-num' part.

    wget https://bitbucket.org/projectname/reponame/raw/HEAD/installscript.sh