Once you have your own VPS or other Internet-available server, you can start hosting your own git repositories. The goal of this tutorial is - for you to go from + for you to go from
git clone github.com/...
- to
+ to
git clone YourLandChadDomainName.xyz/...
- so you can cultivate your own homegrown, grass fed code, rather than
+ + so you can cultivate your own homegrown, grass-fed code, rather than relying on a centralized proprietary service like GitHub.
-What's not included in this tutorial
- --
-
-
- We will not set up a web front end. Your only interaction with
- these repos will be via the
gitcommand line tool. -
- - - We will not support multiple users. It's expected only you, the - server owner, have write access to these repos. - -
Installing git
You most likely already have it installed on your server, but if not, - run + run:
apt install git
+
We don't need any additional software, git itself ships
with everything needed to host a remote repository!
If you're logged in to your server as root and have git
installed, you can become the git user by executing
+
su git
+ Now navigate to/create your desired directory, for example +
-
-cd /srv
-mkdir git
-
+ cd /srv
+mkdir git
Create the repo
Now you can create the bare repository with +
git init --bare my-repo.git
+ By convention, bare repository names end with ".git".
@@ -107,12 +99,12 @@ mkdir git
You will need to be able to login remotely via ssh as the
git user we've used before. To do this, you will either
- need to set up a password for the git user with
-
-
passwd git
-
+ need to set up a password for the git user by running
+ passwd git,
or copy your public SSH key from your local machine to
/home/git/.ssh/authorized_keys.
+ See the SSH keys instructional for details
+ (just log in as git instead of root).