Having a repository Git in Stash, Bitbucket or any other location and adds it to Bamboo under "Bamboo administration >> Build resources >> Linked repositories" or under "Plan configuration >> Repositories" tab does not enables Bamboo to push back to a repository.
Once you create a "Source Code Checkout" task and run your build, Bamboo will checkout from your repository under the "<bamboo-home>/xml-data/build-dir/<project-plan-key>" directory by default.
In Bamboo Server, running the following command under the directory "<bamboo-home>/xml-data/build-dir/<project-plan-key>/.git" you will:
Please, notice the entry (11-Sep-2014 10:41:03 remote.origin.url) is pointing to a cache file that Bamboo creates once a repository is linked.
By going to "Bamboo administration >> Build resources >> Repository settings" you will find all cached repositories Git under the "Git" section.
In Bamboo Cloud, it is more likely the "remote.origin.url" will be pointing to "file://nothing" as per following:
In either Bamboo Server or Bamboo Cloud by running the following command in a Script task you will find something like:
Depending on the Git repository you are working with, you would be able to push back to your repository by updating the remote.origin.url to point to your repository instead to a cache file.
In order to do it so, you can create a "Script" task in your Bamboo plan and add the following:
Instead of having to ask clients to update the remote origin to be "able to push back to a Git repository" it would be beneficial to have an option where you could choose if:
- you want to work with a cache file or;
- you want to preserve origin