dosubot[bot] commented on issue #7533:
URL: 
https://github.com/apache/incubator-devlake/issues/7533#issuecomment-2136093223

   <!-- Answer -->
   To resolve the issue where the DevLake onboarding wizard fails to clone 
private GitHub repositories, throwing an error related to "failed to deepen the 
cloned repo" with exit status 128, you need to ensure that the GitHub 
repository access is properly configured. This typically involves setting up 
the necessary authentication tokens or SSH keys.
   
   In the provided `docker-compose.yml` setup, you should ensure that the 
`.env` file contains the correct GitHub access tokens. Here is an example of 
what you might need to add or verify in your `.env` file:
   
   ```env
   # .env file
   GITHUB_AUTH_TOKEN=your_github_personal_access_token
   ```
   
   Make sure that the `GITHUB_AUTH_TOKEN` is a valid GitHub personal access 
token with the necessary permissions to access the private repositories. The 
required scopes for the token typically include `repo:status`, 
`repo:deployment`, `read:user`, and `read:org`. For private repositories, you 
should extend permissions with `repo`, `read:user`, and `read:org`.
   
   To generate a GitHub personal access token (classic), follow these steps:
   
   1. Sign in at [github.com](https://github.com).
   2. Click your profile photo in the upper-right corner, select **Settings**.
   3. On the left sidebar, click **Developer settings**.
   4. Click **Tokens (classic)** under **Personal access tokens**.
   5. Select the scopes: `repo:status`, `repo:deployment`, `read:user`, and 
`read:org`.
   
   For detailed instructions, refer to [this 
doc](https://devlake.apache.org/docs/Configuration/GitHub/#personal-access-tokens).
   
   Additionally, ensure that the `devlake` service in your `docker-compose.yml` 
is correctly referencing this `.env` file:
   
   ```yml
   devlake:
     image: devlake.docker.scarf.sh/apache/devlake:v1.0.0-beta8   
     ports:
       - 8080:8080
     restart: always
     volumes:
       - devlake-log:/app/logs
     env_file:
       - ./.env
     environment:
       LOGGING_DIR: /app/logs
       TZ: UTC
     depends_on:
       - mysql
   ```
   
   By ensuring that the `.env` file is correctly set up and referenced, you 
should be able to resolve the issue with cloning private GitHub repositories.
   
   Additionally, the error "failed to deepen the cloned repo" can be related to 
the way DevLake handles shallow clones. The `GitcliCloner` in DevLake's 
codebase has a mechanism to deepen the commits by one more step to avoid issues 
with shallow clones. If you encounter this error, it might be due to a problem 
with the commit being deepened, such as a merge commit with multiple parents.
   
   To address this, you can modify the `CloneRepoConfig` to disable shallow 
cloning by setting `NoShallowClone` to `true`. This can be done by updating the 
configuration in the relevant part of the code or configuration file:
   
   ```go
   type CloneRepoConfig struct {
       UseGoGit        *bool
       SkipCommitStat  *bool
       SkipCommitFiles *bool
       NoShallowClone  bool
   }
   ```
   
   Setting `NoShallowClone` to `true` will ensure that the repository is fully 
cloned, which can help avoid the error related to deepening the cloned repo 
<sup>[[1]](https://github.com/apache/incubator-devlake/blob/main/devops/releases/lake-v0.21.0/docker-compose.yml)</sup><sup>[[2]](https://github.com/apache/incubator-devlake/blob/main/backend/plugins/gitextractor/parser/clone_gitcli.go)</sup><sup>[[3]](https://github.com/apache/incubator-devlake/blob/main/config-ui/public/onboard/step-2/github.md)</sup>.
   
   
   <!-- Dosu Comment Footer -->
   <details>
   <summary>
   
   #### Details
   </summary>
   
   **About Dosu**
   This response is meant to be useful and save you time. It is **not meant to 
be a precise solution**, but rather a starting point for your own research.
   
   Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is 
irrelevant.
   </details>
   
   *To continue the conversation, mention @dosu.*
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@devlake.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to