Skip to content

Instantly share code, notes, and snippets.

@IlyaFinkelshteyn
Last active November 25, 2016 08:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IlyaFinkelshteyn/a12c0e604b5eada034281967549daf22 to your computer and use it in GitHub Desktop.
Save IlyaFinkelshteyn/a12c0e604b5eada034281967549daf22 to your computer and use it in GitHub Desktop.

##For private projects:

Points 1 – 3 needed to allow appveyor to push, as by default SSH key used is deployment key which has read-only permissions.

  • Add the following to appveyor.yml (you can do on_success if you need):
deploy_script:
# add username to mercurial settings
  - echo [ui] > C:\Users\appveyor\mercurial.ini
  - echo username = <your_account_name> >> C:\Users\appveyor\mercurial.ini

# create sample change, commit commit and push. Note that [skip ci] in commit message to avoid recurcive builds start
  - echo a > myfile2.txt
  - hg status
  - hg add myfile2.txt
  - hg status
  - hg commit -m "Added one file [skip ci]"
  - hg status
  - hg push

This assumes that <your_account_name> is the same on BitBucket and AppVeyor. Please replace accordingly if it different.

##For public projects: Using hint from [here] (http://stackoverflow.com/questions/2584407/how-to-save-username-and-password-with-mercurial)

environment:
  bbpwd:
    secure: <encrypted_bitBucket_password>
 
deploy_script:  
  - echo [ui] > C:\Users\appveyor\mercurial.ini
  
# note that I was needed to use email I use for BB login, not name I see in BB repo URL
  - echo username = <bitBucket_account_name> >> C:\Users\appveyor\mercurial.ini 

  - echo [auth] >> C:\Users\appveyor\mercurial.ini
  - echo bb.prefix = https://bitbucket.org >> C:\Users\appveyor\mercurial.ini
  - echo bb.username = <bitBucket_account_name> >> C:\Users\appveyor\mercurial.ini
  - echo bb.password = %bbpwd% >> C:\Users\appveyor\mercurial.ini
  
  - echo a > myfile.txt
  - hg status
  - hg add myfile.txt
  - hg status
  - hg commit -m "Added one file [skip ci]"
  - hg status
  - hg push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment