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

Support use of a particular SSH config file, rather than the user-wide default. #73

Open
fredcooke opened this issue Apr 28, 2021 · 4 comments
Assignees

Comments

@fredcooke
Copy link
Collaborator

git config core.sshCommand "ssh -F ~/.ssh/config-some-specific-profile-for-this-particular-project-set-on-github"

Needed on any machine operating on github repos under different identities.

@fredcooke
Copy link
Collaborator Author

In particular, this is needed for fresh clones, so perhaps it could be integrated at the same time as the other issue #21 for emails. Instead of a clone, maybe do:

git init <dir>
cd <dir>
git config email
git config ssh command
git remote add origin <url>
git fetch 
git checkout default branch

Or some other approach.

@stickycode
Copy link
Member

Good idea so the property would need to be set in the config and automatically set in the repositories by branchout, that same thing needs to happen for the author email.

@fredcooke
Copy link
Collaborator Author

This can be worked around by exporting GIT_SSH_COMMAND rather than relying on one set in config - necessary for an initial clone AFAICT. Maybe that's the way to go? Just have it configured and put it in the env before running the Git commands? Not sure if it would end up in the cloned repo or still need setting, separately. Let me check that.... I can't easily check it as I ran another command that does do the setup after the initial clone. But I suspect it's not set after a clone with the variable set like that.

@fredcooke
Copy link
Collaborator Author

fredcooke commented Jun 14, 2021

There's another way to skin this cat provided you're all in on branchout:

Use .ssh/config to configure things like this:

Host org.github
  User git
  Hostname github.com
  identiityFile ~/.ssh/org_rsa

Then do the branchout init/clone like this: org.github:bo_repo.git and it'll use that config, do this differently for each one and they can all coexist. Only the initial clone might require something like:

GIT_SSH_COMMAND="whatever" git clone git@github.com:repo.git and then edit .git/config to suit.

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

No branches or pull requests

2 participants