Push tags to git

Thomas Dahlberg's Avatar

Thomas Dahlberg

30 Jun, 2015 07:50 AM

I am trying to push a tag to a bitbucket repository, with git partially using this http://www.appveyor.com/blog/2015/01/08/building-private-github-rep...

I't seems impossible for me to load the private key somewhere during the process...

The script i've tried is:

Write-Host "Tagging Commit with release #"
ssh -T [email blocked]
git remote -v
$fileContent = "-----BEGIN RSA PRIVATE KEY-----n"
$fileContent += $env:priv_key
$fileContent += "n-----END RSA PRIVATE KEY-----`n"
Set-Content c:\users\appveyor.ssh\id_rsa $fileContent
#$gitString = "ssh-agent -s; ssh-add id_rsa;"
#$gitString += "git tag '$env:APPVEYOR_BUILD_VERSION' '$env:APPVEYOR_REPO_COMMIT';"
#$gitString += "git push origin '$env:APPVEYOR_BUILD_VERSION';"
#Write-Host $gitString
#ssh-agent bash -c $gitString
#ssh-agent -s
#ssh-add id_rsa
#ssh -T [email blocked]
git tag "$env:APPVEYOR_BUILD_VERSION" "$env:APPVEYOR_REPO_COMMIT"
git push origin "$env:APPVEYOR_BUILD_VERSION"
Write-Host "Tag added"

You can see some uncommented code on other tries (and failures). The only result is that the key still is the deployment key used to clone the repo...

appveyor is like this:

environment:
  priv_key:
    secure: vskAnVao6uH5xk1iDmOHmqNknCUZdJ05YvzuLh6/1juD4r1PavCkO/EdiL3wKAf/xIGQ508p62g8nHeVc331y9pNGR8IIZit40uDyGbYtvXTQur4XDYIGYWH20mYOK0bxYp0dQBduaDnggpxuCktg3nNe9WxjYnbsjKj7K00q5PlUbKZ0J7ercHIOvOClVZ3hstrSVJ5/ekEnoZR+N5jS6HHJGCQ44jK20aFHon3E9NKvIPL3yjYWhiWVfntsOZKRY0RXpNWFPQy1kJpsrz5mRkm7/N0a37CkNitkfZH03oZObmuBT2R1bb+xglxWQ/cKrasTlwEsjngCFKK1OOMl12UKmOoGOb/oobPXZZ4TUiP4k33wjYm78HLmxdCpsz5HFU8+L4o57lC1B5D9U+mBSAv2UTfRu5FRdopKakRd8QiYSLPxBF1ji6tGZT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NHapz5+uTxiibLq2ca+x8DvjhbNMkiNo/0n+C2wx+EVMWBgxLBGSadriCTBfiS6+EDIIOIVeaPsq79HPJ4nYma+nH1c9UHVkWiqAdDhmmt92h4PdV4ImPEnJ2TrfGU8KP8fvOPmz/EOHD5npfeAhVPQNdh4sphUIPNuYvnC7McZ6wAhS3N6V1/qSGISWJW/Q5YiDSaRex3dfjY+IgbEuUwFrF85vOoI1uJo5eJSnUI9aIJKtLQpdGXEQnLPL/0UDnhUc/ppJA3VgKhosx8vlL6gVQCCn7KLj5cztS9PKib898iKA5gXeQQ6iGOTs+IsIXawu86rShVQKN/xow3fc995dtTtCU2R0/xgtGvmrUpug/06NFbhgAu7Xwf1T+P1yRb0t7VkgetsF28SAhsuvnHT6JBdKfDFGbs1MT2Ar6ih02D3+AtMtXVS3exgKNnwYt96JQ6JL6GrvOJGCLKY/u71usTcE5UI8NPTdgPSW1SgB8tpn/ReNKfGi9IYRbzASuQh8sFgMVHqkSVuODpZ49MbqteAHjDoMAf5neuCLGBSBK9jE5PE0m7UE+Ha9m2CqNIdhaY4nmFDEfK19PZVRL6PKeSjl7+nQbZCtwmbSs=
...
on_success:
  - ps: .\src\PushTags.ps1
  1. Support Staff 1 Posted by Feodor Fitsner on 01 Jul, 2015 10:04 PM

    Feodor Fitsner's Avatar

    OK, I've just published a new "how-to" about using secure files: http://www.appveyor.com/docs/how-to/secure-files

    Using that tool you can encrypt your SSH key and put into source control. Then decrypt it during the build. That's much easier than tweaking with strings in PS!

    Let me know how that worked for you.

  2. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:57 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac