95 lines
4.1 KiB
Markdown
95 lines
4.1 KiB
Markdown
# What is Git @ etoth.dev
|
|
This service is a private git server, for myself and friends.
|
|
My GitHub is clustered with private repos, because everything I work on, gets versioned & history controlled with git. And I also want to work from my PC at home and from my laptop on the go.
|
|
To clean up this mess, I set up this "GitHub"-like server. Mainly for private projects and co.
|
|
|
|
# How to use Git @ etoth.dev
|
|
It's just a [git server](https://git-scm.com/book/en/v2/Git-on-the-Server-Getting-Git-on-a-Server) with a nice web GUI - just like GitHub, GitLab, ...
|
|
|
|
# How to work on repositorys
|
|
You have two (three, but I will skip tea-cli) ways to get working:
|
|
1. HTTPS
|
|
2. [SSH](#ssh)
|
|
|
|
## HTTPS
|
|
To clone a repository with HTTPS you have to use `git clone https://git.etoth.dev/user/repo.git`.
|
|
Now you can start working and user all other common git commands.
|
|
|
|
## SSH
|
|
Before you can `clone`, `push` and `push` (etc.) you have to make a short configuration to your local ssh config.
|
|
This is because I use a diffrent port for my git server.
|
|
|
|
Here you can copy the commands or get a script for your OS in the [releases](https://git.etoth.dev/etoth/my-git-server/releases) tab.
|
|
|
|
### UNIX-like OS (most Linux distros and macOS)
|
|
```bash
|
|
mkdir -p ~/.ssh && chmod 700 ~/.ssh && [ -f ~/.ssh/config ] && cp ~/.ssh/config ~/.ssh/config.backup.$(date +%Y%m%d_%H%M%S); cat >> ~/.ssh/config << 'EOF'
|
|
|
|
# Gitea Server git.etoth.dev
|
|
Host git.etoth.dev
|
|
HostName git.etoth.dev
|
|
User git
|
|
Port 222
|
|
StrictHostKeyChecking accept-new
|
|
|
|
EOF
|
|
chmod 600 ~/.ssh/config && echo "Done! Usage: git clone git@git.etoth.dev:user/repo.git"
|
|
```
|
|
|
|
### Windows
|
|
CMD version:
|
|
```cmd
|
|
if not exist "%USERPROFILE%\.ssh" mkdir "%USERPROFILE%\.ssh" & if exist "%USERPROFILE%\.ssh\config" copy "%USERPROFILE%\.ssh\config" "%USERPROFILE%\.ssh\config.backup.%date:~-4%%date:~-7,2%%date:~-10,2%_%time:~0,2%%time:~3,2%%time:~6,2%" >nul & (echo. & echo # Gitea Server git.etoth.dev & echo Host git.etoth.dev & echo HostName git.etoth.dev & echo User git & echo Port 222 & echo StrictHostKeyChecking accept-new & echo.) >> "%USERPROFILE%\.ssh\config" & echo Done! Usage: git clone git@git.etoth.dev:user/repo.git
|
|
```
|
|
PowerShell version:
|
|
```powershell
|
|
$sshDir = "$env:USERPROFILE\.ssh"; if (-not (Test-Path $sshDir)) { New-Item -ItemType Directory -Path $sshDir | Out-Null }; $configFile = "$sshDir\config"; if (Test-Path $configFile) { Copy-Item $configFile "$configFile.backup.$(Get-Date -Format 'yyyyMMdd_HHmmss')" }; @"
|
|
|
|
# Gitea Server git.etoth.dev
|
|
Host git.etoth.dev
|
|
HostName git.etoth.dev
|
|
User git
|
|
Port 222
|
|
StrictHostKeyChecking accept-new
|
|
|
|
"@ | Add-Content -Path $configFile; Write-Host "Done! Usage: git clone git@git.etoth.dev:user/repo.git" -ForegroundColor Green
|
|
```
|
|
[Git bash](https://git-scm.com/install/windows) version:
|
|
```bash
|
|
mkdir -p ~/.ssh && chmod 700 ~/.ssh && [ -f ~/.ssh/config ] && cp ~/.ssh/config ~/.ssh/config.backup.$(date +%Y%m%d_%H%M%S); cat >> ~/.ssh/config << 'EOF'
|
|
|
|
# Gitea Server git.etoth.dev
|
|
Host git.etoth.dev
|
|
HostName git.etoth.dev
|
|
User git
|
|
Port 222
|
|
StrictHostKeyChecking accept-new
|
|
|
|
EOF
|
|
chmod 600 ~/.ssh/config && echo "Done! Usage: git clone git@git.etoth.dev:user/repo.git"
|
|
```
|
|
|
|
### Adding a public ssh key
|
|
1. Create or copy an existing ssh key
|
|
- UNIX-like:
|
|
```bash
|
|
ssh-keygen -t ed25519 -C "user@example.com"
|
|
cat ~/.ssh/id_ed25519.pub
|
|
```
|
|
- Windows (PowerShell):
|
|
```powershell
|
|
ssh-keygen -t ed25519 -C "user@example.com"
|
|
Get-Content "$env:USERPROFILE\.ssh\id_ed25519.pub"
|
|
```
|
|
- Windows (CMD):
|
|
```cmd
|
|
ssh-keygen -t ed25519 -C "user@example.com"
|
|
type "%USERPROFILE%\.ssh\id_ed25519.pub"
|
|
```
|
|
2. Copy the output (should start with `ssh-ed25519` and end with your chosen comment)
|
|
3. Now go to: *Settings* --> *SSH/GPG Keys* --> *Add Key*
|
|
4. Test the setup (all OS): `ssh -T git@git.etoth.dev`. The output shoulde be:
|
|
```
|
|
Hi there, user! You've successfully authenticated with the key named YOUR-KEY, but Gitea does not provide shell access.
|
|
If this is unexpected, please log in with password and setup Gitea under another user.
|
|
``` |