git push to remote repository

Hi,

I am cloning the stash repository using Bamboo and then adding one file , committing it to push. I am not able to push the code to remote repository where as it is pushing to local repository only.

 D:\Apps\Atlassian\Data\Bamboo\xml-data\build-dir\IRIS-IRGIT-JOB1>D:\GIT\Git\cmd\git.exe push origin develop
23-Jan-2017 15:27:59To file://D:\Apps\Atlassian\Data\Bamboo\xml-data\build-dir\_git-repositories-cache\7f363ec58eaf0b8a31de372c238909c1f8510801
23-Jan-2017 15:27:59   eeca324..fecb2d3  develop -> develop

 

Here is the code that I have in script job

 

echo "create the file"
echo "${bamboo.version}.${bamboo.major}.${bamboo.minor}" >> file1.txt
D:\GIT\Git\cmd\git.exe add file1.txt
D:\GIT\Git\cmd\git.exe commit -m "adding a file"
D:\GIT\Git\cmd\git.exe remote add origin ssh://git@gitserver:7999/test/test_src.git
D:\GIT\Git\cmd\git.exe push origin develop

 

Can any one please guide me how I can push that to remote repo.

 

Thanks for help in advance.

1 answer

0 vote

Hello Omprakash,

When using Bitbucket server (former Stash) as repository type in Bamboo, Bamboo create a SSH keypair and this is the way Bamboo communicates with Bitbucket server when running Source Code Checkout task. When running the Source Code Checkout task, Bamboo creates the .git under the build working directory and this does not have reference to the actual repository in Bitbucket server (Bamboo uses a git cache instead), so you are not able to push against your repository.

Please, I would suggest you on referring to https://confluence.atlassian.com/display/BAMKB/How+to+push+to+repository+under+SSH+protocol+using+Script+task for further information.

Kind regards,

Rafael

Suggest an answer

Log in or Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

706 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot