1/17/2024 0 Comments Github desktop add submodule“Secure” variables means you can safely put them into appveyor.yml that is visible to others. Image : Ubuntu environment : priv_key : secure : install : - echo "-BEGIN RSA PRIVATE KEY-" > $HOME/.ssh/id_rsa - echo "$" | tr " " "\n" > $HOME/.ssh/id_rsa - echo "-END RSA PRIVATE KEY-" > $HOME/.ssh/id_rsa - git submodule update -init -recursive Security considerations In Install script field paste the following code: Mark variable as “secure” by clicking “lock” icon next to it - this will prevent it from being decoded during pull requests (see explanation below). New lines will be changed to spaces - that’s OK - we’ll turn them back to new lines with PowerShell script shown below. Paste contents of clipboard into value field of environment variable. Open submodules file with private key and copy base-64 body of the key between -BEGIN RSA PRIVATE KEY- and -END RSA PRIVATE KEY- into clipboard: Open “Environment” tab of project settings in AppVeyor and add a new environment variable called priv_key. We’ll store contents of private key in environment variable. Next, during the build on the worker machine we have to put private key contents into %USERPROFILE%\.ssh\id_rsa before running git submodule update -init -recursive command. Configure AppVeyor project to use SSH key Navigate to SSH Keys under your GitHub profile and add a new SSH Key with contents from clipboard and any title. Open submodules.pub file and copy its contents to clipboard. If you have only one sub-module in your main repository you can add public key directly to sub-module repo, however if there are multiple dependencies GitHub won’t allow you to add the same key again. In the current directory you’ll find two files: submodules which contains private key and submodules.pub with public key. Ssh-keygen.exe utility is part of Git installation for Windows and typically is located in C:\Program Files (x86)\Git\bin directory. When prompted enter key file name, say submodules and empty passphrase. Well, you can use the following command during install phase which occurs between clone and build: While building your solution on AppVeyor you need to checkout sub-modules as part of your build. Git has submodules support and this is a wonderful tool for organizing large projects or reusing some code. For SSH protocol to work on Windows the private key should be located in the file %USERPROFILE%\.ssh\id_rsa (command prompt) or $env:userprofile\.ssh\id_rsa (powershell). Public key is deployed to a remote Git repository using GitHub (or Bitbucket) API and private key is pushed to build worker during the build. When you add a project in AppVeyor a new RSA key-pair is generated which consists of private and public keys. How AppVeyor is cloning private reposĪppVeyor uses SSH to clone private Git repositories. The following article was written specifically for GitHub, but some of these techniques could be applied to other Git hosting platforms as well. Building private GitHub repositories with sub-modules
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |