How to Check-in a file in BitBucket Repository with TFS CI Build Definition?

1.4k views Asked by At

The situation:

I am new to BitBucket. I currently I have a repository created in BitBucket and I have a TFS CI build definition with which I have linked the BitBucket Repository through an Endpoint.

The TFS CI Build Definition basically downloads the Readme.md file, which is checked-in in that repository.

Problem 1:

I want to know how can I upload\check-in any file\folders into that repository present on Bitbucket with TFS CI Build?

enter image description here

Problem 2:

In the triggers option of CI build, I don't see the option of Gated trigger present under it, like it used to be when I use TFS as the source code repository.

enter image description here

After creating a batch file,

Batch file script - It works successfully if triggered manually but doesn't work with TFS build.

enter image description here

TFS Build Pipeline which gets stuck at the Git push command while executing the batch file.

enter image description here

1

There are 1 answers

2
Vito Liu On

We can use git command to push the file. Steps:

  1. Create a build pipeline

  2. Add task Command line and enter the code. Please refer to this doc for more details.

     git config --global user.email ""
     git config --global user.name ""
     git init
     git remote add {BitBucket repo git URL}
     git checkout -b {branch name}
     git add {file path}
     git commit -m "xxx"
     git remote add origin {BitBucket repo git URL}
     git push -u origin {branch name}