How To Create Git Server On Ubuntu 18.04 LTS

This post will gonna cover easy way to init git server. To do the following steps, we assume that you already have a server running with SSH access, and you have already understand how git works and you already have some basic knowledge about git commands.

1. Install git on your server, if it is Ubuntu or Debian, you can type this command:

sudo apt install git

2. Create a new user called git, so this user will handle all git transaction. On normal Linux, you can just type:

sudo adduser git

Then you will be asked to set the git user password, just type in password that you can easily remember.

3. Now login to git user that you've been created

su git

4. Initialize your project central location

git init --bare myproject.git

5. Now on your local computer, open terminal on your local, make sure you already have git on your local computer, and then init your git project, and make first commit.

git init
git add .
git commit -m "first commit"

6. Then set remote git location

git remote add origin

7. Push your commit to central repository

git push origin master

It's all done, now that you have a remote central git pointed to your server, whenever you've change something, you can just commit and push.


Popular posts from this blog

SQL Substring Not Start From 0

ERROR 1348 Column Password Is Not Updatable When Updating MySQL Root Password

How To Connect SSH Using PEM Certificate On Windows

How To Create Spring Boot Project Using Netbeans

Intellij Error: Spring class file has wrong version 61.0, should be 55.0