Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to prefer git (ssh) protocol instead of https for cloning repos #312

Closed
hohwille opened this issue May 2, 2024 · 0 comments · Fixed by #724
Closed

Ability to prefer git (ssh) protocol instead of https for cloning repos #312

hohwille opened this issue May 2, 2024 · 0 comments · Fixed by #724
Assignees
Labels
enhancement New feature or request

Comments

@hohwille
Copy link
Member

hohwille commented May 2, 2024

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:
image

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.
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
@hohwille hohwille added the enhancement New feature or request label May 2, 2024
@github-project-automation github-project-automation bot moved this to 🆕 New in IDEasy board May 2, 2024
@diiinesh diiinesh self-assigned this Jul 23, 2024
@hohwille hohwille moved this from 🆕 New to 🏗 In progress in IDEasy board Aug 6, 2024
@diiinesh diiinesh assigned alfeilex and unassigned diiinesh Oct 23, 2024
alfeilex added a commit to alfeilex/IDEasy that referenced this issue Oct 29, 2024
alfeilex added a commit to alfeilex/IDEasy that referenced this issue Oct 29, 2024
alfeilex added a commit to alfeilex/IDEasy that referenced this issue Oct 30, 2024
alfeilex added a commit to alfeilex/IDEasy that referenced this issue Oct 30, 2024
@hohwille hohwille added this to the release:2024.11.001 milestone Oct 31, 2024
alfeilex added a commit to alfeilex/IDEasy that referenced this issue Nov 4, 2024
hohwille added a commit to alfeilex/IDEasy that referenced this issue Nov 11, 2024
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in IDEasy board Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

3 participants