Background
Common Development Paradigms
- local: development
- remote: running
Tools
- Git
Vscode
with extensions for remote development- ssh
- docker
Object
local
- Convenience with IDE
- bad case: development only with shell
- Local side and remote side build up well-organized version control
Remote
- Convenient version control
- after push from local side, remote side will automatically sync with pushed branch.
- Create virtual environment
- Well isolated
- Portable
- Friendly rebuild
Plan
Git
Remote
- Build up
repo
.
git --bare init [仓库名].git
- Configure authority.
git config receive.denyCurrentBranch ignore
- Record current directory path.
- Enter into
hooks
directory.
cd hooks
vim post-receive
- File
post-receive
help us sync our code. - File content,
git-dir
usually will be ignored.
#!/bin/sh
git --work-tree=[Which directory to sync server-side code to] --git-dir=[Server-side repository address] checkout -f
- Explanation for
post-receive
.
使用git在服务器上部署git仓库并实现提交代码时同步代码到生产环境 - 服务器运维 – 宋巧林的博客
- Remember add
x
flag for file.
Local
- Most important information for local side is address for remote
repo
:ssh://[user@ip]:[``server`` file path]