我在NAS上运行着本地git服务器,并且正在笔记本电脑和工作站上进行开发,所有这些都在我的本地网络中。因此,如果要在新的空仓库中启动项目,请遵循this answer和
cd ${PROJECT}.git; git init --bare
上创建裸仓库“ mynewproject.git” cd ${PROJECT}; git init
上创建一个空的'repo'“ mynewproject” git add . ; git commit -m "initial commit" -a
中进行首次提交git remote add origin ssh://${USER}@${REMOTEIP}${PROJECT}.git
的远程来源git push origin master
rm -rf $PROJECT
然后,我可以从其他计算机上克隆${PROJECT}.git
存储库。整个过程似乎过于复杂。我是说,我编写了脚本,
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
但是,这是正确的方法吗?
答案 0 :(得分:1)
您的过程总体上不错,但是有点复杂。你不需要 NAS上的非裸仓库,因此您的工作流程应为
import UIKit
let str = "17:02:09"
let mydateFormatter = DateFormatter()
mydateFormatter.dateFormat = "hh:mm:ss"
let timezone = TimeZone(abbreviation: "CEST") ?? TimeZone.current
mydateFormatter.timeZone = timezone
mydateFormatter.locale = Locale(identifier: "de_DE") as Locale?
let date1 = mydateFormatter.date(from: str)
print(date1?.description ?? "no date available")
。cd ${PROJECT}.git; git init --bare
存储库。这会将遥控器添加到非裸仓库中。${PROJECT}.git
。cd ${PROJECT}; git init; git remote add origin ssh://${USER}@${HOSTIP}${PROJECT}.git
上的克隆的非裸仓库中进行初始提交。git add . ; git commit -m "initial commit" -a
。