Git

[Git/Window] Visual Studio Code에서 terminal을 GitBash로 셋팅하기

s.a 2022. 3. 28. 18:23
반응형

window 환경에서 vscode로 개발을 하다보면 리눅스 명령어와 달라서 헷갈릴 때가 있다.

그래서 터미널의 기본 셋팅을 GitBash로 변경하여 동일한 명령어를 사용하고자한다.

 

1. setting.json 파일을 연다.

- 검색을 활성화 (Ctrl + Shift + p)한 뒤,  "preferences: Open Settings (JSON)"을 연다. 

2. setting.json 파일을 수정한다. 

아래 내용을 추가한다.


"terminal.integrated.profiles.windows": {
        "PowerShell": {
            "source": "PowerShell",
            "icon": "terminal-powershell"
        },
        "Command Prompt": {
            "path": [
                "${env:windir}\\Sysnative\\cmd.exe",
                "${env:windir}\\System32\\cmd.exe"
            ],
            "args": [],
            "icon": "terminal-cmd"
        },
        "GitBash": {
            "path":["C:\\dev\\Git\\bin\\bash.exe"],   // 본인PC의 Git의 경로로 수정
            "icon":"terminal-bash"
        },
        "setting.json": {
            "path": "C:\\WINDOWS\\System32\\cmd.exe",
            "args": []
        }
    },
    "terminal.integrated.defaultProfile.windows": "GitBash"

 


 

2-1. 기존 파일 내용

{
    "files.exclude": {
        "**/.classpath": true,
        "**/.project": true,
        "**/.settings": true,
        "**/.factorypath": true
    },
    "editor.suggestSelection": "first",
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    "javascript.updateImportsOnFileMove.enabled": "always"
}

2-2. 수정 후 파일 내용

{
    "files.exclude": {
        "**/.classpath": true,
        "**/.project": true,
        "**/.settings": true,
        "**/.factorypath": true
    },
    "editor.suggestSelection": "first",
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    "javascript.updateImportsOnFileMove.enabled": "always",


    "terminal.integrated.profiles.windows": {
        "PowerShell": {
            "source": "PowerShell",
            "icon": "terminal-powershell"
        },
        "Command Prompt": {
            "path": [
                "${env:windir}\\Sysnative\\cmd.exe",
                "${env:windir}\\System32\\cmd.exe"
            ],
            "args": [],
            "icon": "terminal-cmd"
        },
        "GitBash": {
            "path":["C:\\dev\\Git\\bin\\bash.exe"],
            "icon":"terminal-bash"
        },
        "setting.json": {
            "path": "C:\\WINDOWS\\System32\\cmd.exe",
            "args": []
        }
    },
    "terminal.integrated.defaultProfile.windows": "GitBash",
    "terminal.explorerKind": "external"
}

 

3. VSCode를 재실행한다.

 

4. 터미널에서 GitBash가 기본값으로 설정되어있는 것을 확인한다.