linux:git
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
linux:git [2023/03/04 13:32] – rlunaro | linux:git [2023/03/04 13:55] (current) – rlunaro | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Git ====== | ====== Git ====== | ||
- | + | * [[GitServerShared|Git: create | |
- | ===== Set up a git server ===== | + | * [[GitServerPrivate|Git: |
- | + | ||
- | First, install git on your machine. In my case, because it's an | + | |
- | ubuntu, I've run: | + | |
- | + | ||
- | < | + | |
- | sudo apt-get install git | + | |
- | </ | + | |
- | + | ||
- | ===== Create git user ===== | + | |
- | + | ||
- | I prefer to create | + | |
- | If you prefer to create a system user, just add the **--system** | + | |
- | option | + | |
- | + | ||
- | The **--create-home** option is needed because there we will be | + | |
- | storing the public keys of the users of the repository. | + | |
- | + | ||
- | < | + | |
- | useradd --create-home --user-group | + | |
- | </ | + | |
- | + | ||
- | ===== Enter as git user and add remote public keys ===== | + | |
- | + | ||
- | < | + | |
- | ~$ mkdir .ssh | + | |
- | ~$ chmod o=,g= .ssh | + | |
- | ~$ cd .ssh | + | |
- | ~/.ssh$ touch authorized_keys | + | |
- | ~/.ssh$ chmod o=,g= authorized_keys | + | |
- | </ | + | |
- | + | ||
- | ===== Add the keys of the different users of the git repository | + | |
- | + | ||
- | + | ||
- | < | + | |
- | ~$ cat public_key_of_first_user.pub >> .ssh/ | + | |
- | ~$ rm public_key_of_first_user.pub # you can remove the public key afterwards if you want | + | |
- | </ | + | |
- | + | ||
- | ===== Verification: | + | |
- | + | ||
- | Check that you can make a ssh to the remote computer with no password request: | + | |
- | + | ||
- | < | + | |
- | rluna@asustao: | + | |
- | The authenticity of host ' | + | |
- | ED25519 key fingerprint | + | |
- | This key is not known by any other names | + | |
- | Are you sure you want to continue connecting (yes/ | + | |
- | Warning: Permanently added ' | + | |
- | + | ||
- | The programs included with the Ubuntu system are free software; | + | |
- | the exact distribution terms for each program are described in the | + | |
- | individual files in / | + | |
- | + | ||
- | Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by | + | |
- | applicable law. | + | |
- | + | ||
- | git@ubuntu2004: | + | |
- | + | ||
- | </ | + | |
- | + | ||
- | If this is step succeeds, you can continue. | + | |
- | + | ||
- | ==== Create a directory for your repositories ==== | + | |
- | + | ||
- | In the server computer, I've created a ```/ | + | |
- | to hold the repositories. | + | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | < | + | |
- | usermod --shell /bin/false git | + | |
- | </ | + | |
linux/git.1677936745.txt.gz · Last modified: 2023/03/04 13:32 by rlunaro