As a IDEasy, I want to be able to configure my preference for https vs. ssh for cloning my projects so that I can benefit from authentication advantages.
Most git repositories can be cloned and synced both via https or git (ssh) protocol and developers have the freedom of choice between those two. See e.g. on github:

Some enterprises host their git repos behind some general SSO for all https URLs that requires 2FA, cookies, etc.
Therefore, developers might have less trouble using git (ssh) protocol but in order to use it, you first need to do some manual preparations:
- generate an SSH keypair
- login manually into the git service and register the SSH public key in your profile
- potentially more stuff (e.g. ssh agent for unlocking private key with passphrase)
Therefore simple users can start easily with https that is default choice while advanced users often prefer git (ssh).
This story is about creating a property PREFERRED_GIT_PROTOCOL that allows to automatically configure a preferred git protocol.
The default is that this property is not defined and then the behave is like the current state where the git repository URL is used as is for cloning.
However, if this property is defined, then a git repository URL is converted to the preferred protocol:
PREFERRED_GIT_PROTOCOL=git will automatically change https git URLs to git
PREFERRED_GIT_PROTOCOL=https will automatically change git git URLs to https
The transformation can be seen from our github url:
So the prefix is either https:// or git@ and after the hostname there is a slash (/) for https but a colon (:) for git.
In case PREFERRED_GIT_PROTOCOL is defined and the git URL starts with its value, then nothing is to be done, otherwise the transformation.
One excuse I would see as hardcoded build-in is that for the hostname github.com we should not change the protocol, because we only use this for public OSS repositories that do not need any authentication at all and most of our users will not have a github account with SSH setup. So https://github.com/... will just work out of the box but via git typical users will end up with this:
Cloning into 'D:\projects\devonfw\workspaces\test\IDEasy'...
Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
As a IDEasy, I want to be able to configure my preference for
httpsvs.sshfor cloning my projects so that I can benefit from authentication advantages.Most git repositories can be cloned and synced both via

httpsorgit(ssh) protocol and developers have the freedom of choice between those two. See e.g. on github:Some enterprises host their git repos behind some general SSO for all
httpsURLs that requires 2FA, cookies, etc.Therefore, developers might have less trouble using
git(ssh) protocol but in order to use it, you first need to do some manual preparations:Therefore simple users can start easily with
httpsthat is default choice while advanced users often prefergit(ssh).This story is about creating a property
PREFERRED_GIT_PROTOCOLthat allows to automatically configure a preferred git protocol.The default is that this property is not defined and then the behave is like the current state where the git repository URL is used as is for cloning.
However, if this property is defined, then a git repository URL is converted to the preferred protocol:
PREFERRED_GIT_PROTOCOL=gitwill automatically changehttpsgit URLs togitPREFERRED_GIT_PROTOCOL=httpswill automatically changegitgit URLs tohttpsThe transformation can be seen from our github url:
So the prefix is either
https://orgit@and after the hostname there is a slash (/) for https but a colon (:) for git.In case
PREFERRED_GIT_PROTOCOLis defined and the git URL starts with its value, then nothing is to be done, otherwise the transformation.One excuse I would see as hardcoded build-in is that for the hostname
github.comwe should not change the protocol, because we only use this for public OSS repositories that do not need any authentication at all and most of our users will not have a github account with SSH setup. Sohttps://github.com/...will just work out of the box but via git typical users will end up with this: