I have a local git server running on my NAS and I'm developing on my laptop and workstation, all in my local network. So, if I want to start a project in a new empty repo, I'm following this answer and
- create a bare repo "mynewproject.git" on the NAS
cd ${PROJECT}.git; git init --bare - create an empty 'repo' "mynewproject", also on the NAS
cd ${PROJECT}; git init - make an initial commit in "newproject"
git add . ; git commit -m "initial commit" -a - make the bare repo the remote origin of the current folder
git remote add origin ssh://${USER}@${REMOTEIP}${PROJECT}.git - push to master
git push origin master - delete the 'project' directory
rm -rf $PROJECT
And then I can clone the ${PROJECT}.git repo from other machines. This whole process seems overly complicated. I mean, I scripted it,
HOSTIP=XXX.XXX.XXX.XXX
USER=YYYYY
PROJECT=$1
[[ -z "${PROJECT}" ]] && exit 1
PROJECTNAME=${PROJECT}
PROJECT=$(pwd)/${PROJECT}
# create project and .git folders
mkdir ${PROJECT}
mkdir ${PROJECT}.git
# initialize folders for git
cd ${PROJECT}.git
git init --bare
cd ${PROJECT}
git init
# create initial project directory
echo "#!/bin/bash" > ${PROJECT}/ENV_${PROJECTNAME}.sh
git add .
git commit -m "initial commit" -a
# 'link' to 'remote' .git folder
git remote add origin ssh://${USER}@${HOSTIP}${PROJECT}.git
# push to master
git push origin master
# delete 'project' directory
rm -rf $PROJECT
echo "CREATED PROJECT $PROJECT.git"
echo "Clone with git clone ssh://${USER}@${HOSTIP}${PROJECT}"
exit 0
but still, is this the right way to go about this?