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

Pushing over SSH #47

Open
datashard opened this issue Oct 7, 2024 · 7 comments
Open

Pushing over SSH #47

datashard opened this issue Oct 7, 2024 · 7 comments

Comments

@datashard
Copy link

More of a question than an actual Issue, because I'm kinda lost.

How do I get pushing over SSH to work when using the Docker Image / docker compose?

@datashard
Copy link
Author

I'm guessing I might need a .ssh/authorized_keys file, since it looks like it does accept ssh connections lol

@icyphox
Copy link
Owner

icyphox commented Oct 7, 2024

I’m not entirely sure how you’re running the container, but in my K3s homelab I have my git repos on the host itself, and I push to it using the “git” user with a .ssh/authorized_keys file in its home directory. I then mount this home directory inside my legit container. Not sure if that helps.

@datashard
Copy link
Author

It does! This confirms my earlier thought lmao

Guessing the .ssh/authorized_keys file would be in /home/git/.ssh/authorized_keys within the container?

@icyphox
Copy link
Owner

icyphox commented Oct 7, 2024

Hm, I haven't tried running ssh in the container since I push to the underlying host's /home/git (container has read-only access to this dir) but I suppose that could work as well.

@datashard
Copy link
Author

I'll try it! :D

I'll report back if it works

@datashard
Copy link
Author

datashard commented Oct 8, 2024

Well, ssh-ing into the container doesn't work. Shouldn't be surprised since I doubt there's a SSH Server running in there? It doesn't even have (ba)sh so I should've figured that out sooner lol

Would you mind sharing the code for the way you push?
If I can't get it to work I might just run an hourly cron to cp certain things from my forgejo instance.

As for general http auth, you could theoretically try and use a htpasswd file? I haven't looked into it much but I think it should work?

@icyphox
Copy link
Owner

icyphox commented Oct 9, 2024

Oh, yeah, of course—there is no ssh inside the container. It's a very light image.

There isn't much "code" to share. I have the git repos on a machine and push over ssh as you would anywhere else. This directory of bare git repositories gets mounted inside my legit container. legit itself doesn't deal with any of the ssh pushing.

As for http auth, that isn't supported by legit (explicitly disabled). The recommended approach is what I described above. Bear in mind: legit is read-only. It will simply serve git repos in repo.scanPath. Populating that directory is the user's problem.

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