Community Articles

Find and share helpful community-sourced technical articles.
Announcements
Celebrating as our community reaches 100,000 members! Thank you!
avatar
Contributor

Problem Description

When importing a project on CDSW / CML from a private repository in Gitlab / GitHub using the repository URL over HTTPS, it will fail to be created. Screenshot 2023-02-28 at 5.46.56 PM.png
The URL that is passed here is: 

 

 

https://github.com/garrynv/demo123.git

 

 

Screenshot 2023-02-28 at 5.50.32 PM.png

Since the repository is private, you cannot only pass the URL to import it. GitHub will not be able to authenticate the request and will reject it. In the early days, users used to pass their username and password in the HTTPS URL and it used to work. something like below:

 

 

 

https://username:password@github.com/garrynv/demo123.git

 

 

 

However, due to restrictions on Gitlab / GitHub end, this will not work anymore. Users will have to generate a PAToken and pass the PAToken to access private repositories remotely.

Solution

You can refer to the following documents on how to generate Personal Access Token 

Github: Creating a personal access token

Gitlab: Personal access tokens

Once you generate the Personal access Token, for Github you will need to follow the below format to import the project:

 

 

 

https://<PersonalAccessToken>@github.com/garrynv/demo123.git

 

 

 

For example

Screenshot 2023-02-28 at 5.58.55 PM.png

Project creation will be successful. 
Screenshot 2023-02-28 at 5.56.24 PM.png

For Gitlab the format is slightly different: 

 

 

https://username:<PersonalAccessToken>@gitlab.com/garrynv/demo123.git

 

 

 

Hope this helps 🙂 

793 Views