Skip to content

bare repositories

These don’t have a working tree , the purpose is to have a central repository
Adding files is not easy, not like in a normal non-bare repository (with git add , git commit etc)
You update a bare repository by pushing to it (git push) from another repository.

The convention is to add .git to a bare repo folder name

( you can always add a working dir

config

on server

cd home/
mkdir repos
chmod -R 777 repos
git init --bare  /home/repos/scripts.git

local

# only after there is a git locally first , see below ls
git remote add central  {url}     # or :  git remote add origin  {url}
# => url  : ssh://user@server/home/user/repo.git 
cd /mnt/data/IT/scripts
touch .gitignore  
git init  
git add .  
git commit -m "Initial Commit"  

git remote add central ssh://root@176.223.129.90/home/repos/scripts.git
# git push --all central  # this syntax is bash only ?
git push central main   ( push to remote , specify branch ) 
#   if dir is not specified ,git will clone in current dir
    git clone <repo> <directory>
# =>
git clone ssh://root@176.223.129.90/home/repos/scripts.git  c:\repos\scripts        # windows laptop 
# or 
git clone ssh://root@176.223.129.90/home/repos/scripts.git  /mnt/data/IT/scripts/   # linux laptop

# git pull  <remote>  <branch> 
git pull central  main (master)
    fatal: couldn't find remote ref master  => is now main   (under woke presure) 

wm

/home/repos
/home/repos/dev.git
/home/repos/pks.git
/home/repos/scripts.git

sys
sys/config
lx
win