3 ms·
I know this is going to sound silly, but how does one setup their own git server?
by chris_wot 1y ago
I know this is going to sound silly, but how does one setup their own git server?
- esseph 1y agobrew install git (guessing, not a Mac user) sudo apt-get install git sudo dnf install git (Etc)
- terminalbraid 1y agoWhat's the server included with those packages? I thought those were just the command line utilities.
- beng-nl 1y agoTrue. Git works over ssh natively. you set up a repo in your homedir using “git init —bare”. Say in a repo subdir. Then doing git clone user@server:subdir will clone that repo on another machine and allow push and pull over ssh. In other words, the server is sshd. Enjoy!
- esseph 1y agowhispers "Pst, it's the same!”
- terminalbraid 1y agoI beg to differ as those, by themselves, will not give you a server as was requested. The examples upthread all include additional software, such as sshd, gitea, etc, for a reason. necessary != sufficient My question was posed because I believe the post did not read the original request carefully.
- esseph 1y agoYou don't need gitea for git and every Linux server has ssh, this doesn't make any sense.
- terminalbraid 1y agoIf you really think you can claim "every machine with git installed has an ssh server enabled" (and is somehow linux to boot) and that you have convinced yourself "that makes sense" I don't know what to tell you other than your experience is shockingly narrow.
- esseph 1y agoI am specifically talking about Linux, did you misread? My experience is managing over a hundred thousand vms at once across multiple countries, and have managed large fleets of tens of thousands or hundreds thousand+ for decades. This is old hat. My desktop runs Linux. My laptop runs Linux. My phone runs Linux. The phone is the only one without a running SSH server. I'm pretty sure the openssh server is also a default package in Fedora Workstation, it's just got the service disabled by default unless you flick on a check box in the Gnome window. Windows Server also supports SSH, and has several shell options. I couldn't answer for any Apple device. I guess my experience is narrow, though. Hey, how many git servers do you know not running Linux? That's an interesting question! Edit: Curious what you think both GitLab and GitHub run on, and if those have ssh enabled or not.
- chris_wot 1y agoThey did not read what I asked for, it is true.
- wpollock 1y agoA standard git package includes gitweb, a web server for your repos. For a more feature-full web server, you have choices such as forgejo. As others have said, you don't need a server, ssh access is all that's needed.
- moribvndvs 1y agoRe macOS: if you have Xcode w/ command line tools installed, it will already have git installed
- terminalbraid 1y agogit works over ssh. If you have an account you can ssh into you have a git server. That's literally all the git@(whatever) is under the hood that you set your remotes to. Everything is just dumping UI over a file system and executing command line stuff. If you want that too take a look at forgejo or gitlab, both of which I use for self hosting. The setup is similar to setting up any other server that requires user accounts, a database, and exposed ports.
- dboreham 1y agoEasy mode is: deploy Gitea.
- ctippett 1y agoAs a lightweight solution (no web UI), there's Charm's Soft Serve[1]. Their product byline: "A tasty, self-hostable Git server for the command line." [1] https://github.com/charmbracelet/soft-serve https://github.com/charmbracelet/soft-serve
- cnst 1y agohttps://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server https://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-... It's literally far more trivial than you may think. (At least if you already own a VPS or a dedicated server.) Basically, (1), add a git user, (2), configure .ssh/authorized_keys, and that's basically it! To add a bit more security, you may also want to edit /etc/shells and add git-shell as a login shell, then change git user to use that shell, but that's entirely optional (and it'd actually make it less trivial to create add extra repos, so, for a single-user repos, you may want to delay doing that). In all, the entire set of official instructions can be printed on like a single double-sided Letter / A4 piece of paper. P.S. Actually, I guess it's 3 single-sided pages, but that's only because you'd be printing the example SSH key twice, which takes a quarter of an A4 each time, thus, the entire official instructions take almost 3 single-sided pages total.
- Jaxan 1y agoThis is also a good reminder that you technically don’t need a “server”. If you and your friend want to collaborate, you could in principle pull from their computer (and vice versa), if you have (ssh) access.
- blueflow 1y agoPrivate repos: git init --bare in your homedir on the server, and then push/pull using user@hostname:path/from/homedir/to/repo.git as remote url. Optionally, public repos: Set-up git-daemon in some /var directoy and do the git init dance there. Also touch the git-daemon-export-ok file to whitelist each repo for public serving. chown the repository directory to your own user so you can write there freely, while git-dameon can read and serve the contents to the world.
- captn3m0 1y agoI’ve been running rgit, which is a nicer frontend than cgit. If you really want SSH, you can either use a full fledged server like Gitea/Gogs/Forgejo etc or run something on top of your existing SSH daemon like gitolite, which manages authorized_keys for you.