Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Bitbucket pipelines and go dependencies

Adolfo Carpio
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 22, 2020

Good day to all.

Hope somebody can help with the following issue.

I'm trying to get pipelines going on a go project with one dependency. Both repos are private. When the pipeline tries to execute a go get -v, I'm getting the following error:

+ go get -v# cd .; git ls-remote https://bitbucket.org/asklepio/cloud-server-commonfatal: could not read Username for 'https://bitbucket.org': terminal prompts disabled# cd .; hg identify -- https://bitbucket.org/asklepio/cloud-server-commonabort: http authorization required for https://bitbucket.org/asklepio/cloud-server-commongo: bitbucket.org/asklepio/cloud-server-common@v1.1.1: reading https://api.bitbucket.org/2.0/repositories/asklepio/cloud-server-common?fields=scm: 403 Forbidden server response: Access denied. You must have write or admin access.

I added a ssh key to the main project and the public portion to access keys of the dependent project, as suggested by some post on the internet, but I keep getting the error.

There is a similar unanswered question from 2018: https://community.atlassian.com/t5/Bitbucket-questions/permissions-problem-using-go-project-and-pipelines/qaq-p/729891.

Best regards,

Adolfo

2 answers

1 vote
maironcosta
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 4, 2020

you can add a "App Password" and then add it in your pipeline or docker... 

git config --global url."https://${PIPELINE_USER}:${PIPELINE_APP_PASSWORD}@bitbucket.org".insteadOf "https://bitbucket.org"

PIPELINE_USER = [YOUR_USERNAME]

PIPELINE_APP_PASSWORD= its your key that you'll generate.

 

to create a new "App Password" you must go in "Personal Settings > Apps Password".

Anh Tran December 6, 2020

Marion - this works well! Thank-you!

0 votes
Reid
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 25, 2020

Hi Aldofo,

Welcome to the community!

I have some questions regarding how you are setup. Though first, I would clarify that since you are using HTTPS to access the repositories, the SSH key would not be used for authentication. Instead, there will be a need to provide the web credentials or a personal token in order to authenticate to the server.

I do note that there is a message noting that "Terminal prompts are disabled", at a point where I would expect that there would be a prompt for the username/password combination. Additionally, I see another error that "http authentication is required". Both of these allude to the need for a credential helper to provide the necessary authentication information.

  • Are you using a Credentials Helper that would be providing the necessary HTTPS credentials to the server? You can check if one is available with the command in the build environment:
  • git credential

    You should see a usage message, if there is a credential helper available to your Git installation.

  • What platform are you using for this build? This will guide me on how you would need to install a Credential Helper, if one is not already available.
  1. For macOS, Xcode and Homebrew installations of Git will include the osxkeychain credential helper.
  2. For Linux installations should include a less secure credential helper for that platform which caches the data to a local file ~/.git-credentials
  3. For Windows, I believe you need to install a separate utility to provide the helper application to Git.

Once a credential helper is available, it needs to be configured with the needed username and password combination, or an access token. This will then satisfy the authentication needs of later Git operations over HTTPS.

One final thought, if the build process is disposable or otherwise a single use environment, like a Docker image for instance. You may need to provide the credential helper data to the Docker image thru an additional COPY step, which would land the ~/.git-credentials file onto its local filesystem for later Git operations.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events