- We need to authenticate to multiple private external repositories using credentials stored in a file
- We don't want use private/public RSA keys with ssh
I tried to understand what was the default .gitconfig location in Azure:
git config --system -l
git config --global -l
git config --local -l ( only for local repository )
git config --show-origin -l
I discovered that $HOME/.gitconfig is not writale and we cannot create it in Kudu CMD console :
- 409 Conflict: Could not write to local resource 'D:\home\.gitconfig' due to error
- 'Access to the path 'D:\home\.gitconfig' is denied.'.
My conclusion was :
- system and global locations are unwritable
- we cannot use user .gitconfig file in default $HOME location
- the only chance is change GIT_CONFIG env var to point to a user defined file in a writable location
- we can copy git config options from --system config and paste in our custom file d:/home/git/config
You can test correct gitconfig placement with the following commands that start git with your new config file:
git config --file d:/home/git/config -l
GIT_CONFIG=d:/home/git/config git config -l
Use this template or copy from git system config :
[http]
sslcainfo=D:/Program Files (x86)/Git/mingw32/ssl/certs/ca-bundle.crt
#sslbackend=openssl
[diff "astextplain"]
textconv=astextplain
[filter "lfs"]
clean=git-lfs clean -- %f
smudge=git-lfs smudge -- %f
required=true
process=git-lfs filter-process
[pack]
packsizelimit=2g
[credential]
helper="store --file=d:/home/git/credentials"
You need to set this env var in porta.azure.com app properties:
set GIT_CONFIG=d:/home/git/config
set XDG_CONFIG_HOME=d:/home
Add your user details into your git config
[user]
name = Matteo Orefice
email = [email protected]
After generating PAT Personal Access Token you can authenticate to your external visualstudio.com repo, put this in the credentials
file
https://matteo.orefice:[email protected]
set DEPLOYMENT_TARGET=d:/home/site/app
set WEBROOT_PATH=d:/home/site/app/wwwroot
If you installed composer as azure extension make sure to put in your web.config file this directives:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
...
<rewrite>
<rules>
<clear/>
...
your other rules
</rules>
</rewrite>
</system.webServer>
</configuration>