# Create git server from scratch ## Create bare git on server 1. Install git on server ```bash sudo apt update sudo apt install git ``` 2. Create directory for git ```bash mkdir cd ``` 3. Initialize bare repository ```bash git init --bare .git ``` 4. Set permission (optional) ```bash chown -R : ~//.git ``` ## Push code from your computer 1. Go to local repository ```bash cd ``` 2. Add remote repository ```bash git remote add origin :~//.git # sample git remote add origin nik-deb:~/git/automation.git ``` 3. Push code as main ```bash git push -u origin main ```