How to install Bitbucket repo by branch or commit?

Thomas Chestnut December 28, 2023

I'm trying to install a repository by either a branch or specific commit hash. The npm docs seem to suggest that something like this should work:

for a specific branch:
"repo-name": "git+ssh://git@bitbucket.org:OrgName/projectname.git#<branchname>"
for a specific commit:
"repo-name": "git+ssh://git@bitbucket.org:OrgName/projectname.git#<commithash>"

 

But when I run "npm i --verbose" trying to install by commit hash, the install gets stuck with a 404 for the repo like this:

npm http fetch GET 404 https://bitbucket.org/OrgName/projectname/get/<commithash>.tar.gz  

 

Does anyone know the correct way to install a branch or commit this way?

Thank you in advance!

1 answer

1 accepted

2 votes
Answer accepted
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 29, 2023

Hello @Thomas Chestnut and welcome to the Community!

The example templates you provided use SSH connection, while the error message you shared seems to be using HTTP. I suspect there may be some misconfiguration in your package.json.

While I'm not very familiar with npm configuration itself, I found the following articles/threads with instructions on how to setup the npm dependencies to fetch from a bitbucket repository that may be of help : 

You might want to try using the format specified on those pages and let us know how it goes.

Thank you, @Thomas Chestnut !

Patrik S

Thomas Chestnut December 29, 2023

Hi @Patrik S , thanks for response! I'll check out those articles and see if that helps out.

Thank you!

Thomas Chestnut January 2, 2024

Thanks @Patrik S , those discussions helped! Tagging my commit and referencing the tag like this seems to fixed the issue. 

"repo-name": "git+ssh://git@bitbucket.org:OrgName/projectname.git#<tag>"

  

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events