Sfoglia il codice sorgente

Merge branch 'master' of http://alisz.titanera.com:3000/titan/CRM into swaggers

jace 6 anni fa
parent
commit
f4c7991c99
1 ha cambiato i file con 41 aggiunte e 5 eliminazioni
  1. 41 5
      README.md

+ 41 - 5
README.md

@@ -6,24 +6,60 @@ CRM项目多版本并行管理基础版本
 ==
 首先,每个项目都是基于master分支进行开发部署的,当需要新开发部署一套项目时,在本地基于master分支创建一个以项目名命名的分支即可,如hyde:
 
-    git checkout -b hyde master
+    git checkout -b swaggers master
 
 添加追踪、提交,再推送至仓库:
 
-    git push origin hyde
+    git push origin swaggers
 
 当master分支做了修改,想在分支也做同步修改时:
     
     git checkout master                                 #切换至主分支
     git pull                                            #拉取远程主分支代码
-    git checkout hyde                                   #切换至hyde分支
+    git checkout swaggers                                   #切换至swaggers分支
     git merge master                                    #hyde分支合并
-    git push origin hyde                                #推送至远程分支hyde
+    git push origin swaggers                                #推送至远程分支swaggers
+
+远程主机配置:
+    
+在centos用户的家目录(即/home/centos/)下初始化一个空的Git仓库:
+    
+    git init --bare swaggers.git
     
+在web目录下做第一次检出:
+
+    cd /data/web/src/
+    sudo git clone /home/centos/swaggers.git
+
+编写hook脚本
+    
+    vim post-receive
+    #!/bin/sh
+    unset $(git rev-parse --local-env-vars)
+    cd /data/web/src/swaggers/
+    sudo git pull
+    (切记将post-receive脚本权限修改为可执行文件,777即可)
+
+本地配置ssh(否则可能无法提交至远程主机)生成公钥私钥文件
+    
+    ssh-keygen -t rsa -C "username"
+    
+将本地C:\Users\user\.ssh\id_rsa.pub公钥文件内容复制至远程主机/home/centos/.ssh/authorized_keys文件中(不同用户的公钥文件换行保存)             
+        
 当分支开发完毕,可以添加远程主机(主机名最好也与项目名称统一),并将分支推送至远程主机,再由远程主机上的hook脚本将项目检出至web目录:
 
-    git remote add giturl                               #   添加远程主机
+    git remote add giturl                               #   添加远程主机     
+    如 git remote add swaggers centos@13.124.37.191:/home/centos/swaggers.git
+    
     git push [<host>] [<localbranch>][:<remotebranch>]  #推送代码,host默认为origin,localbranch默认为当前分支,remotebranch默认为当前分支追踪的分支,当remotebranch不存在时,会在远程主机新建一个同名分支,省略localbranch时,表示删除指定的远程分支,等同于git push <host> --delete <remotebranch>,当前分支与远程分支之间存在追踪关系时,可省略localbranch和remotebranch.如git push hyde hyde:master
+    如 git push swaggers swaggers:master
+
+    git pull remotehost remotebranch localbranch		从remotehost主机拉取remotebranch分支代码到localbranch分支
+        
+    git push [<host>] [<localbranch>][:<remotebranch>]	推送代码,host默认为origin,localbranch默认为当前分支,remotebranch默认为当前分支追踪的分支
+                                                                当remotebranch不存在时,会在远程主机新建一个同名分支
+                                                                省略localbranch时,表示删除指定的远程分支,等同于git push <host> --delete <remotebranch>
+                                                                当前分支与远程分支之间存在追踪关系时,可省略localbranch和remotebranch
 
 
 二、项目基本介绍