Automatic tag of BitBucket repository from Bamboo Windows agent (Powershell / Batch)












0















I'm trying to automate the tagging of the repositories of my project. The code is hosted on a private BitBucket, and Continuous Integration is automated on Bamboo which runs only on a Windows 10 agent (at the moment). The agent has MINGW Git capabilities as well as the PowerShell, but from Bamboo I can only setup command line tasks on either cmd.exe or Windows PowerShell.



I have set up a specific user on BitBucket with write permissions on the repository, with a known password. The user authenticates on BitBucket via SSH:



remote.origin.url=ssh://git@git.mycompany.com:7999/myproject/myrepository.git


The origin.url variable is set directly from Bamboo variables, so no simple way to switch to a https://username:password@git.mycompany.com... url to manually specify the password.



Without doing anything more than setting the local user.name and user.password to the proper values, the git push --tags command fails:



Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.


So I guessed the proper way to grant the user access rights was to use SSH authentication method. However, it seems the Git instance in PowerShell is not aware of pageant: after importing the ssh key via Git Bash the command still fails on PowerShell, but is successful in Git Bash. At this point, I'm stuck since it seems there's no way to either let PowerShell be aware of my id_rsa files, either .pub or .ppk, and attempts to call Git Bash from PowerShell to make the other executable do the dirty work have failed:



"C:Program FilesGitgit-bash.exe git push --tags --set-upstream origin test-tag-branch"
"C:Program FilesGitbingit.exe push --tags --set-upstream origin test-tag-branch"
"C:Program FilesGitbingit" "push --tags --set-upstream origin test-tag-branch"
"C:Program FilesGitbinbash.exe git push --tags --set-upstream origin test-tag-branch"


Also, it's important to mention that while the push above is just one, the actual behaviour would be to compute a tag from the build number and push the tag on various repositories: since it's a proper script instead of a single command, adding MinGW as an executable to the Bamboo agent capabilities and running a "executable" job with the push parameters is not going to work (unless MinGW shell itself is able to process unix-like scripts).



Did anyone successfully setup a similar automation? What am I doing wrong? Suggestions to tackle the problem from a different perspective?










share|improve this question



























    0















    I'm trying to automate the tagging of the repositories of my project. The code is hosted on a private BitBucket, and Continuous Integration is automated on Bamboo which runs only on a Windows 10 agent (at the moment). The agent has MINGW Git capabilities as well as the PowerShell, but from Bamboo I can only setup command line tasks on either cmd.exe or Windows PowerShell.



    I have set up a specific user on BitBucket with write permissions on the repository, with a known password. The user authenticates on BitBucket via SSH:



    remote.origin.url=ssh://git@git.mycompany.com:7999/myproject/myrepository.git


    The origin.url variable is set directly from Bamboo variables, so no simple way to switch to a https://username:password@git.mycompany.com... url to manually specify the password.



    Without doing anything more than setting the local user.name and user.password to the proper values, the git push --tags command fails:



    Permission denied (publickey).
    fatal: Could not read from remote repository.
    Please make sure you have the correct access rights and the repository exists.


    So I guessed the proper way to grant the user access rights was to use SSH authentication method. However, it seems the Git instance in PowerShell is not aware of pageant: after importing the ssh key via Git Bash the command still fails on PowerShell, but is successful in Git Bash. At this point, I'm stuck since it seems there's no way to either let PowerShell be aware of my id_rsa files, either .pub or .ppk, and attempts to call Git Bash from PowerShell to make the other executable do the dirty work have failed:



    "C:Program FilesGitgit-bash.exe git push --tags --set-upstream origin test-tag-branch"
    "C:Program FilesGitbingit.exe push --tags --set-upstream origin test-tag-branch"
    "C:Program FilesGitbingit" "push --tags --set-upstream origin test-tag-branch"
    "C:Program FilesGitbinbash.exe git push --tags --set-upstream origin test-tag-branch"


    Also, it's important to mention that while the push above is just one, the actual behaviour would be to compute a tag from the build number and push the tag on various repositories: since it's a proper script instead of a single command, adding MinGW as an executable to the Bamboo agent capabilities and running a "executable" job with the push parameters is not going to work (unless MinGW shell itself is able to process unix-like scripts).



    Did anyone successfully setup a similar automation? What am I doing wrong? Suggestions to tackle the problem from a different perspective?










    share|improve this question

























      0












      0








      0








      I'm trying to automate the tagging of the repositories of my project. The code is hosted on a private BitBucket, and Continuous Integration is automated on Bamboo which runs only on a Windows 10 agent (at the moment). The agent has MINGW Git capabilities as well as the PowerShell, but from Bamboo I can only setup command line tasks on either cmd.exe or Windows PowerShell.



      I have set up a specific user on BitBucket with write permissions on the repository, with a known password. The user authenticates on BitBucket via SSH:



      remote.origin.url=ssh://git@git.mycompany.com:7999/myproject/myrepository.git


      The origin.url variable is set directly from Bamboo variables, so no simple way to switch to a https://username:password@git.mycompany.com... url to manually specify the password.



      Without doing anything more than setting the local user.name and user.password to the proper values, the git push --tags command fails:



      Permission denied (publickey).
      fatal: Could not read from remote repository.
      Please make sure you have the correct access rights and the repository exists.


      So I guessed the proper way to grant the user access rights was to use SSH authentication method. However, it seems the Git instance in PowerShell is not aware of pageant: after importing the ssh key via Git Bash the command still fails on PowerShell, but is successful in Git Bash. At this point, I'm stuck since it seems there's no way to either let PowerShell be aware of my id_rsa files, either .pub or .ppk, and attempts to call Git Bash from PowerShell to make the other executable do the dirty work have failed:



      "C:Program FilesGitgit-bash.exe git push --tags --set-upstream origin test-tag-branch"
      "C:Program FilesGitbingit.exe push --tags --set-upstream origin test-tag-branch"
      "C:Program FilesGitbingit" "push --tags --set-upstream origin test-tag-branch"
      "C:Program FilesGitbinbash.exe git push --tags --set-upstream origin test-tag-branch"


      Also, it's important to mention that while the push above is just one, the actual behaviour would be to compute a tag from the build number and push the tag on various repositories: since it's a proper script instead of a single command, adding MinGW as an executable to the Bamboo agent capabilities and running a "executable" job with the push parameters is not going to work (unless MinGW shell itself is able to process unix-like scripts).



      Did anyone successfully setup a similar automation? What am I doing wrong? Suggestions to tackle the problem from a different perspective?










      share|improve this question














      I'm trying to automate the tagging of the repositories of my project. The code is hosted on a private BitBucket, and Continuous Integration is automated on Bamboo which runs only on a Windows 10 agent (at the moment). The agent has MINGW Git capabilities as well as the PowerShell, but from Bamboo I can only setup command line tasks on either cmd.exe or Windows PowerShell.



      I have set up a specific user on BitBucket with write permissions on the repository, with a known password. The user authenticates on BitBucket via SSH:



      remote.origin.url=ssh://git@git.mycompany.com:7999/myproject/myrepository.git


      The origin.url variable is set directly from Bamboo variables, so no simple way to switch to a https://username:password@git.mycompany.com... url to manually specify the password.



      Without doing anything more than setting the local user.name and user.password to the proper values, the git push --tags command fails:



      Permission denied (publickey).
      fatal: Could not read from remote repository.
      Please make sure you have the correct access rights and the repository exists.


      So I guessed the proper way to grant the user access rights was to use SSH authentication method. However, it seems the Git instance in PowerShell is not aware of pageant: after importing the ssh key via Git Bash the command still fails on PowerShell, but is successful in Git Bash. At this point, I'm stuck since it seems there's no way to either let PowerShell be aware of my id_rsa files, either .pub or .ppk, and attempts to call Git Bash from PowerShell to make the other executable do the dirty work have failed:



      "C:Program FilesGitgit-bash.exe git push --tags --set-upstream origin test-tag-branch"
      "C:Program FilesGitbingit.exe push --tags --set-upstream origin test-tag-branch"
      "C:Program FilesGitbingit" "push --tags --set-upstream origin test-tag-branch"
      "C:Program FilesGitbinbash.exe git push --tags --set-upstream origin test-tag-branch"


      Also, it's important to mention that while the push above is just one, the actual behaviour would be to compute a tag from the build number and push the tag on various repositories: since it's a proper script instead of a single command, adding MinGW as an executable to the Bamboo agent capabilities and running a "executable" job with the push parameters is not going to work (unless MinGW shell itself is able to process unix-like scripts).



      Did anyone successfully setup a similar automation? What am I doing wrong? Suggestions to tackle the problem from a different perspective?







      windows-10 powershell batch-file git authentication






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 11 at 16:13









      phagiophagio

      12




      12






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1393225%2fautomatic-tag-of-bitbucket-repository-from-bamboo-windows-agent-powershell-ba%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Super User!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1393225%2fautomatic-tag-of-bitbucket-repository-from-bamboo-windows-agent-powershell-ba%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Plaza Victoria

          In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

          How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...