[Question][Module Name] Is it possible to clone Gitlab repos using SSH?
Question
Is there a Env Variable for enable cloning git repos using ssh instead of http https?
Screenshots
If applicable, add screenshots to help explain.
Additional context
I have a docker compose setup
Yes, it is possible to clone GitLab repositories using SSH in the incubator-devlake repository. The buildCloneCommand function in the clone_gitcli.go file includes handling for SSH URLs and private keys [1].
Regarding environment variables, there isn't a specific environment variable to enable cloning via SSH instead of HTTP/HTTPS. However, the method of cloning is determined by the URL scheme (e.g., ssh:// for SSH). You can configure the repository URL to use the SSH scheme to clone via SSH.
For example, you can set the repository URL in your configuration to use the SSH format:
GITLAB_REPO_URL: "ssh://[email protected]:username/repo.git"
This will ensure that the cloning process uses SSH.
Details
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.
To continue the conversation, mention @dosu.
But how can i define it should always use ssh
To ensure that cloning always uses SSH, you need to configure the repository URLs to use the SSH scheme. Unfortunately, there isn't a specific environment variable in the incubator-devlake repository to enforce SSH for all GitLab repository cloning. However, you can achieve this by setting the repository URLs to use the SSH format.
For example, in your configuration, you can specify the repository URL like this:
GITLAB_REPO_URL: "ssh://[email protected]:username/repo.git"
This will ensure that the cloning process uses SSH. The cloning method is determined by the URL scheme, so by setting the URL to use ssh://, you enforce the use of SSH for cloning.
Additionally, the CloneGitRepo function in the repo_cloner.go file and the buildCloneCommand function in the clone_gitcli.go file handle SSH URLs and private keys, ensuring that SSH is used when the URL scheme is ssh [1][2].
Details
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.
To continue the conversation, mention @dosu.
I'm not sure there is a way to provide an ssh key to use to clone repositories, unless undocumented. This should perhaps be labeled as a feature request.
This issue has been automatically marked as stale because it has been inactive for 60 days. It will be closed in next 7 days if no further activity occurs.
This issue has been closed because it has been inactive for a long time. You can reopen it if you encounter the similar problem in the future.