Skip to content

[Dinesh] Provision to give custom ssh path #29

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

Merged
merged 1 commit into from
Apr 14, 2020

Conversation

dineshba
Copy link
Member

Signed-off-by: Dinesh [email protected]

Provision to give custom ssh path using env variable GG_SSH_PATH

@jpninanjohn
Copy link
Collaborator

Does it read only from env ??

@jpninanjohn jpninanjohn merged commit d9b8010 into master Apr 14, 2020
@dineshba dineshba deleted the custom_git_ssh_path branch April 14, 2020 15:44
@dineshba
Copy link
Member Author

Currently Yes. Should this be part of .ggConf file also ?

@jpninanjohn
Copy link
Collaborator

yeah i was working on tat only

@jpninanjohn
Copy link
Collaborator

@dineshba I finished the custom ssh via config file. But I dont think custom ssh path via env is needed anymore. Its refactored to work from a single place in the code(conf.rs). Also it allows the ssh config to be handled by the ssh agent directly. I have removed this implementation from fetch.rs for now. If you think a env is still needed, I will add it to the conf.rs.

Thoughts?

@dineshba
Copy link
Member Author

If the git remote is ssh based (not http based), git will talk to remote using ssh. ssh key to be used, by the ssh-agent can be configured at ~/.ssh/config
Example:

Host gitlab.xxx.it
    HostName gitlab.xxx.it
    User git
    IdentityFile ~/.ssh/id_ed25519

#Personal Account
Host github.com
    HostName github.com
    User git
    IdentityFile ~/.ssh/id_rsa

For gitlab it is one key and github one key. Best solution is to read this file and use automatically. I created env based as a quick/hacky fix. Thoughts ?

I couldn't able to find a library to read this file. May be you can also try to find one. If not, we can write custom code to parse this file and choose the correct ssh private key based on the git remote.

@jpninanjohn
Copy link
Collaborator

jpninanjohn commented Apr 30, 2020

Can you try this scenario by setting up ssh_agent: true in gg conifg. For me this worked out of the box. People can give which ssh file to use in the config file separately if they want. But if they choose theay can just let the ssh-agent take care of it. It automatically uses the correct ssh key to access. If ssh_agent is set to true, the ssh key file provided is irrelevant as the agent will not respect it anyways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants