fix: 修复git set proxy 命令执行出错的bug

pull/67/head
xiaojunnuo 2020-12-04 23:01:58 +08:00
parent b1ed9f4d31
commit ee4b63a933
1 changed files with 6 additions and 6 deletions

View File

@ -24,11 +24,11 @@ const Plugin = function (context) {
async setProxy (ip, port) { async setProxy (ip, port) {
const cmds = [ const cmds = [
`git config --global http.proxy http://${ip}:${port}`, `git config --global http.proxy http://${ip}:${port} `,
`git config --global https.proxy http://${ip}:${port}` `git config --global https.proxy http://${ip}:${port} `
] ]
if (pluginConfig.setting.sslVerify === false) { if (pluginConfig.setting.sslVerify === false) {
cmds.push('git config http.sslVerify "false"') cmds.push('git config --global http.sslVerify false ')
} }
const ret = await shell.exec(cmds, { type: 'cmd' }) const ret = await shell.exec(cmds, { type: 'cmd' })
@ -40,11 +40,11 @@ const Plugin = function (context) {
async unsetProxy () { async unsetProxy () {
const cmds = [ const cmds = [
'git config --global --unset https.proxy', 'git config --global --unset https.proxy ',
'git config --global --unset http.proxy' 'git config --global --unset http.proxy '
] ]
if (pluginConfig.setting.sslVerify === false) { if (pluginConfig.setting.sslVerify === false) {
cmds.push('git config --unset http.sslVerify ') cmds.push('git config --global http.sslVerify true ')
} }
const ret = await shell.exec(cmds, { type: 'cmd' }) const ret = await shell.exec(cmds, { type: 'cmd' })
event.fire('status', { key: 'plugin.git.enabled', value: false }) event.fire('status', { key: 'plugin.git.enabled', value: false })