본문 바로가기
개발

[VScode, Cursor] 에디터로 Git Commit 작성하는 방법

by coking 2025. 9. 30.
반응형

Git 에디터 설정하기

VSCode 또는 Cursor 에디터에서 Git commit 메시지를 작성하려면, Git의 기본 에디터를 설정해야 합니다.

VSCode 사용 시:

git config --global core.editor "code --wait"

Cursor 사용 시:

git config --global core.editor "cursor --wait"

이제 git commit 명령어를 실행하면 설정한 에디터가 자동으로 열립니다.

에러 발생 시 해결 방법

문제 상황

설정 후 커밋을 시도하면 다음과 같은 에러가 발생할 수 있습니다:

git commit
hint: Waiting for your editor to close the file... 
cursor --wait: cursor: command not found
error: there was a problem with the editor 'cursor --wait'

원인

Cursor의 CLI 명령어가 시스템에 설치되지 않았기 때문입니다. (이건 vscode도 같은 방법으로 해결합니다.)

해결 방법

1단계: Cursor CLI 설치

  1. Cursor 또는 vscode 에디터를 엽니다
  2. Cmd + Shift + P (Mac) 또는 Ctrl + Shift + P (Windows)
  3. "shell command" 입력
  4. "Shell Command: Install 'cursor' command" 선택

2단계: 터미널 재시작

 

3단계: 확인

git commit    # 에디터가 열립니다

사용 방법

  1. git add . 로 파일 스테이징
  2. git commit 실행
  3. Cursor 에디터가 자동으로 열림
  4. 커밋 메시지 작성
  5. 파일 저장 후 닫기 (Cmd+S 후 Cmd+W)
  6. 커밋 완료!
반응형

댓글