Reputation: 329
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
Upvotes: 3
Views: 7632
Reputation: 1
As an update considering that Bitbucket now request token for repo, the following line allow me to use wget for a raw file.
!wget --http-user={bitbucketUsername} --http-password={AppPassword} --auth-no-challenge 'https://api.bitbucket.org/2.0/repositories/{owner}/{repository_name}/src/master/{filepath}/{filename}'
Upvotes: 0
Reputation: 106
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
Upvotes: 2
Reputation: 1607
Actually this is documented, see https://confluence.atlassian.com/bitbucket/hyperlinking-to-source-code-in-bitbucket-824476709.html.
Upvotes: 0
Reputation: 3925
The "common" (and horribly insecure) approach to that is nowadays to pipe the downloaded content directly into the shell:
wget -O - https://bitbucket.org/projectname/reponame/master/installscript.sh | /bin/sh
See also
https://bitbucket.org/site/master/issues/9358/permalink-to-the-head-revision-of-a
Upvotes: 0