git push to remote repository

Omprakash Thamsetty
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 23, 2017

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 votes
rsperafico
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 24, 2017

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
TAGS
AUG Leaders

Atlassian Community Events