User Tools

Site Tools


linux:git

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
linux:git [2023/03/04 14:32] rlunarolinux:git [2023/03/04 14:54] rlunaro
Line 1: Line 1:
 ====== Git ====== ====== Git ======
  
- +  [[GitServerShared|Git: create your own git server, but sharing access to all the repositories]]
-===== Set up a git server ===== +
- +
-First, install git on your machine. In my case, because it's an  +
-ubuntu, I've run:  +
- +
-<code> +
-sudo apt-get install git  +
-</code> +
- +
-===== Create git user ===== +
- +
-I prefer to create a "normal" **git** user instead a system one.  +
-If you prefer to create a system user, just add the **--system**  +
-option to the command: +
- +
-The **--create-home** option is needed because there we will be  +
-storing the public keys of the users of the repository.  +
- +
-<code> +
-useradd --create-home --user-group git +
-</code> +
- +
-===== Enter as git user and add remote public keys ===== +
- +
-<code> +
-~$ mkdir .ssh +
-~$ chmod o=,g= .ssh +
-~$ cd .ssh +
-~/.ssh$ touch authorized_keys +
-~/.ssh$ chmod o=,g= authorized_keys +
-</code> +
- +
-===== Add the keys of the different users of the git repository ===== +
- +
- +
-<code> +
-~$ cat public_key_of_first_user.pub >> .ssh/authorized_keys +
-~$ rm public_key_of_first_user.pub # you can remove the public key afterwards if you want +
-</code> +
- +
-===== Verification: in the first_user computer check that you can log in as git user to the remote computer ===== +
- +
-Check that you can make a ssh to the remote computer with no password request:  +
- +
-<code> +
-rluna@asustao:~$ ssh git@192.168.0.21 +
-The authenticity of host '192.168.0.21 (192.168.0.21)' can't be established. +
-ED25519 key fingerprint is SHA256:PvSiThCnDq8pNOXyVgsq5vsXLME6oYIbCs0v5urvcpE. +
-This key is not known by any other names +
-Are you sure you want to continue connecting (yes/no/[fingerprint])? yes +
-Warning: Permanently added '192.168.0.21' (ED25519) to the list of known hosts. +
- +
-The programs included with the Ubuntu system are free software; +
-the exact distribution terms for each program are described in the +
-individual files in /usr/share/doc/*/copyright. +
- +
-Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by +
-applicable law. +
- +
-git@ubuntu2004:~$  +
- +
-</code> +
- +
-If this is step succeeds, you can continue.  +
- +
-==== Create a directory for your repositories ==== +
- +
-In the server computerI've created a ```/var/git``` directory +
-to hold the repositories.  +
- +
- +
- +
- +
- +
- +
- +
-<code> +
-usermod --shell /bin/false git +
-</code>+
  
  
  
linux/git.txt · Last modified: 2023/03/04 14:55 by rlunaro