Skip to content
GwiyeomGo Tech Blog
About GwiyeomGo

Git config 명령어 정리

GIT, 20224 min read

git config

system

global

local

배경 20221128

블로그 템플릿을 사용해서 블로그를 만들고 있다 템플릿 업그레이드 후 gh-page 로 배포하는 과정에서 Filename too long 이라는 에러가 발생했다

해결

아래 명령어를 goland terminal 에서 실행 git config --system core.longpaths true 그런데.. error:colud not lock config file ...permission denied 에러 발생 어떤블로그에서 아래와 같이 설명했고

  • 리포지토리의 파일과 디렉토리들에 대한 권한이 루트 디렉토리에 종속되어있을 때 발생할 수 있음 sudo 명령어를 사용한다면 sudo (username) -R .git 을 사용해 권한을 부여한다고 한다 window 에서는 config 파일에 직접 찾아가 관리자 권한으로 열고 longpaths = true 을 core 명령에 추가했다 추가후 git config --list 추가된 것 확인

https://www.lainyzine.com/ko/article/how-to-set-git-repository-username-and-email/ https://velog.io/@keywookim/We.TIL-%EB%B2%88%EC%99%B8-Git-%EB%8B%A8%EC%B6%95%ED%82%A4-%EC%A0%95%EB%A6%AC https://xtring-dev.tistory.com/entry/Git-Git-Github-Commad-%EC%A0%95%EB%A6%AC%ED%95%98%EA%B8%B0

2022-11-17

goland 버전을 2020 에서 2022로 변경했다 변경 후 핫픽스가 발생되서 로컬 master 에서 branch 를 생성해서 origin/master 로 push 했다

PS C:\react\admin> `git push origin #123`
fatal: The current branch #123 has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin #123
To have this happen automatically for branches without a tracking
upstream, see 'push.autoSetupRemote' in 'git help config'.
//upstream : 현재의 브랜치를 업스트림 브랜치에 푸쉬한다

위 메세지 처럼 push 실패했다 찾아보니 처음으로 push를 할 때 git config 에 push.autoSetupRemote 를 true 로 변경해야했다.

PS C:\react\admin> `git config --global --add push.autoSetupRemote true`
PS C:\react\admin> `git push origin #123`

goversion 을 올리니 기존의 동작하는 기능들에 문제가 생겼다

  1. ctx.Bind(&verificationInformation);

Bind 할 때 struct field에 query 를

참고

https://blog.aaronroh.org/120

2023 03 17

GIT autocrlf (core.autocrlf = true)

배경

평소와 같이 기능을 수정하고 commit 을 하려고 시도 했다 그런데 warning: in the working copy of '', LF will be replaced by CRLF the next time Git touches it 에러가 발생했고 찾아보니 줄바꿈 (line ending - 개행문자)로 발생한 문제라고 한다

LF (line feed)

  • Microsoft Windows 에서 줄바꿈

CR+LF (carriage return + line feed)

//모든 줄바꿈이 Microsoft Windows 스타일로 설정되어 있도록 보장
git config --global core.autocrlf true

참고

https://www.lesstif.com/gitbook/git-crlf-20776404.html https://nochoco-lee.tistory.com/133 https://velog.io/@cgw7976/giruboyGit-LF-will-be-replaced-by-CRLF-the-next-time-Git-touches-it https://dabo-dev.tistory.com/13

2022-11-11

GIT make new branch + contain 'hash'(#)

배경

업무에서 개발할때 프로젝트를 gitLab 에 올리고 clone 받아서 pc 에 설치한다 그후 origin remote 와 fork 한 프로젝트 url 로 개인 remote 저장소를 만든다 그리고 origin 의 특정 master,dev 등.. branch 에서 새 가지를 뻗어나간다

예) origin/ dev 에서 새 branch 를 생성하는 방법은 git checkout -b (새 이슈번호) 사용 새 이슈번호 ex) #123 과 같이 쓴다

왜..branch 번호에 # 붙였지?

commit 메세지를 쓸때 '#1 ...오류 수정 '과 같이 쓸 경우 #1 이슈번호와 연결해준다

이슈번호 # 을 사용한다면..

질문 "error: switch "b' requires a value" => 에러 발생 왜?

이 경우 아래처럼 \로 이스케이프하거나 이름을 작은따옴표/큰따옴표로 묶어서 해결

git checkout -b \#1
git checkout -b "#1"
git checkout -b '#1'

참고

error: switch "b' requires a value

배경

git remote update git checkout -t origin/#2 https://cjh5414.github.io/get-git-remote-branch/

커밋에 # 을 주석으로 처리해서 rebase 실패 => 평소 사용하지 않는 ; 를 주석 기호로 변경

git config --global core.commentChar ";"

© 2024 by GwiyeomGo Tech Blog. All rights reserved.