sublime 自动上传代码至服务器

代码更改保存自动上传至服务器

sublime 安装插件sftp

  • sftp插件安装就不用介绍了

项目配置

  • 本地建一个目录
1
2
3
-D盘
--code
---项目目录

项目目录右键,“SFTP/FTP->Map to Remote…”,生成配置文件sftp-config.json,查看破解版

下面是我的配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{
// The tab key will cycle through the settings when first created
// Visit http://wbond.net/sublime_packages/sftp/settings for help

// sftp, ftp or ftps
"type": "sftp",

"save_before_upload": true,
"upload_on_save": true,
"sync_down_on_open": true,
"sync_skip_deletes": false,
"sync_same_age": true,
"confirm_downloads": false,
"confirm_sync": true,
"confirm_overwrite_newer": false,

"host": "172.29.9.62",
"user": "developer",
"password": "devexhmfb@62",
"port": "8022",

"remote_path": "/data/wwwroot/myxz/",
"ignore_regexes": [
"\\.sublime-(project|workspace)", "sftp-config(-alt\\d?)?\\.json",
"sftp-settings\\.json", "/venv/", "\\.svn/", "\\.hg/", "\\.git/",
"\\.bzr", "_darcs", "CVS", "\\.DS_Store", "Thumbs\\.db", "desktop\\.ini",
"\\.xlsx","\\.gitignore","\\.gitattributes","\\.buildpath","\\.md","\\.lock","\\.json","Document/","Data/","back/","\\.project"
],
//"file_permissions": "664",
//"dir_permissions": "775",

//"extra_list_connections": 0,

"connect_timeout": 30,
//"keepalive": 120,
//"ftp_passive_mode": true,
//"ftp_obey_passive_host": false,
//"ssh_key_file": "~/.ssh/id_rsa",
//"sftp_flags": ["-F", "/path/to/ssh_config"],

//"preserve_modification_times": false,
//"remote_time_offset_in_hours": 0,
"remote_encoding": "cp1258"
//"remote_locale": "C",
//"allow_config_upload": false,
}

注意事项

  • 目录对应一直
  • 修改 “remote_encoding”: “cp1258” 不然会报错
  • 可以开启”sync_down_on_open”: true 不用每次打开都要down下,一次down成功就可以了
  • 排除一些敏感文件,防止误操作
  • 破解sftp可以自行Google “sftp keygen” ,sftp快捷键
谢谢您请我喝咖啡!