How to clone a private git repository from Azure App Service Kudu console

This post has been republished via RSS; it originally appeared at: New blog articles in Microsoft Tech Community.

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





REMEMBER: these articles are REPUBLISHED. Your best bet to get a reply is to follow the link at the top of the post to the ORIGINAL post! BUT you're more than welcome to start discussions here:

This site uses Akismet to reduce spam. Learn how your comment data is processed.