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 Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

22,166 views 26 11
Join discussion

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