代码跑局域网内,没有外网~无法从 git 拉代码,除了删了然后复制有啥比较方便的操作?谢谢~
1 yuhr123 2019-05-11 14:11:57 +08:00 把 git 也建在内网 |
![]() | 3 qiukun 2019-05-11 15:59:33 +08:00 via Android 写成 sh |
![]() | 4 tomczhen 2019-05-11 16:21:15 +08:00 |
5 ksupertu 2019-05-11 16:58:43 +08:00 via iPhone 打包 docker image 导来导去 |
11 xpresslink 2019-05-11 22:07:15 +08:00 我以前做过类似的项目,服务器和开发机都是在同一个局域网内。 直接在服务器上安装 Git 服务,然后初始化一个空的 git 远程仓库。 在开发机上把代码直接 push 到服务器远程仓库。 在远程仓库的写个 post-receive 钩子脚本,用来在 push 新代码后自动触发事件,自动更新代码和重启服务。 钩子脚本很简单 # ======================================= #!/bin/bash # File_Name=post-receive # git 用来 push 后部署代码到网站的钩子 # put this file under git-repo/project.git/hooks/ and chmod +x webdir='/webapps/djangosite' gitdir='/home/gitrepo/djangosite.git' git --work-tree=$webdir --git-dir=$gitdir checkout -f chmod +x $webdir/*.sh $webdir/run.sh restart # ======================================== run.sh 是重启服务的脚本。 |
12 xpresslink 2019-05-11 22:09:03 +08:00 |
13 julyclyde 2019-05-13 11:13:37 +08:00 推和拉的选择,很大程度上受限于网络通信 |