cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

Download private repo from GitHub Enterprise in Databricks notebook

User16753724663
Valued Contributor

We are trying to download our repository which is hosted on GitHub Enterprise to use its python libraries in our notebooks.

Earlier we had issues with downloading our repository using the repos feature in Databricks platform since only notebooks can be version controlled using repos tab.

we use “%sh git clone” inside the notebook for our use case. But we faced some issues on that workaround as well.

Steps tried:

1. Created personal access token in my github account with almost all options enabled.

2. Added that personal access token to my user settings in our Databricks deployment. Following instructions from this link:

https://docs.databricks.com/notebooks/github-version-control.html

3. Created a notebook in a cluster and executed the below command and got this error.

Cmd: %sh git clone https://github.com/repo/repo.git

Error: Cloning into 'repo'...

fatal: could not read Username for 'https://github.com': No such device or address

I believe the cluster is not able to fetch my username, I am not sure on how to add it or the recommended way to do it (either by git config or may be how to give this information in the git URL itself).

1 REPLY 1

User16753724663
Valued Contributor

To fix the issue, we need to pass the token in the header itself

git clone https://<token>:x-oauth-basic@github.com/owner/repo.git

Example:

%sh
 
git clone https://<token>@github.com/darshanbargal4747/databricks.git

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.