How to clone a private git repository from Azure App Service Kudu console
Published Aug 15 2021 06:54 PM 9,898 Views

In azure app service Kudu console,  it is easy to clone a public git repository using "git clone" command,  when it comes to private repository,   you may find the same "git clone" command is stuck at "Cloning" step and isn't working any more.  This is simply because the repository is a private one and need to be authenticated,  in the meanwhile, we need an non-interactive way since Kudu console doesn't support popped-out windows.



There are in total 3 approaches to clone the private git repository:


Approach 1 (Username & Password):  

The most obvious way to fix this is to put your username and password in the git URL:



git clone https://$username:$$username/$repo -v





The side effect is that the user credentials would be saved in the .git/config file and everybody who can access Kudu console will be able to view the password.


Approach 2 (SSH key):

Step 1:   Send a GET request to the Kudu site to get the SSH key,   the URL looks like:


Step 2:   Remove the double quote and add the SSH key in the Github SSH key



Step 3:   Go to Kudu console and use the SSH way to clone the repository:



git clone$username/$repo.git



For example:



Approach 3 (Personal Access Token):

This approach is to use "personal access token" created in the github developer settings page:



git clone https://$$username/$repo.git





Version history
Last update:
‎Aug 13 2021 03:08 AM
Updated by: