문서의 이전 판입니다!
sudo add-apt-repository ppa:git-core/ppa sudo apt update sudo apt install git
env GIT_SSL_NO_VERIFY=true
붙여서 실행git config --global
이면 전체 시스템 공통 설정 --global
빼면 해당 리포지토리 지역 설정git config --global user.email "your@email.com" git config --global user.name "사용자명" # push/pull 기본설정 - 현재 브랜치에 대해서만 작동 git config --global push.default simple # Windows에서 파일 모드 변경으로 인한 Update 방지 git config --global core.filemode false # Mac OS X 유니코드 문제? 아직도 발생하나? # git config --global core.precomposeunicode true
git config --global core.precomposeunicode true
user.name
을 다시 설정할 것.IncludeIf
구문으로 작업 디렉토리별로 기본 git 설정을 할 수 있다. ~/.gitconfig
에[includeIf "gitdir:~/my-personal-projects/"] #마지막 "/" 필수 path = .git_personal_projects
~/.git_personal_proejcts
[user] email = kwon37xi@gmail.com name = KwonNamSon
includeIf
에 있는 설정을 덮어쓴다.sudo add-apt-repository ppa:git-core/ppa sudo apt-get update sudo apt-get install git
# 기본 캐시 시간 15분 git config --global credential.helper cache # 캐시 시간 지정 git config --global credential.helper 'cache --timeout=7200'
gnome-keyring
등에 직접 의존하지 않고 중간 단계인 libsecret
을 거쳐 gnome-keyring
을 사용한다.sudo apt-get install libsecret-1-0 libsecret-1-dev cd /usr/share/doc/git/contrib/credential/libsecret sudo make git config --global credential.helper /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret
libsecret
기반으로 gnome-keyring
과 연동한다.# cmd set LC_ALL=C.UTF-8 # powershell $env:LC_ALL='C.UTF-8' # 시스템 환경변수에 넣어둘 것
git-diff-meld.sh
#!/bin/sh meld "$2" "$5" > /dev/null 2>&1
~/.gitconfig
git config --global diff.external '/path/to/git-diff-meld.sh'
git config --global merge.tool meld
~/.gitconfig
[diff] external = git_diff_wrapper [pager] diff =
~/bin/git_diff_wrapper
#!/bin/sh vimdiff "$2" "$5"
git diff --no-ext-diff -w | vim -R -
*.exe # 모든 .exe 파일을 ignore 하되 !node.exe # node.exe 는 ignore 하지 않는다. 상위 설정을 아래에서 덮어씀.
# Create a ~/.gitignore in your user directory cd ~/ touch .gitignore # Exclude bin and .metadata directories echo "bin" >> .gitignore echo ".metadata" >> .gitignore echo "*~" >> .gitignore echo "target/" >> .gitignore # Configure Git to use this file # as global .gitignore git config --global core.excludesfile ~/.gitignore
projectdir/.git/hooks
에 후킹 파일을 둔다.projectdir/.githooks
에 후킹 스크립트를 넣는다.git config --global core.hooksPath /path/to/my/centralized/hooks
$HOME/.gitmessage.txt
파일에 기본 커밋 메시지를 작성해 두고서,
git config --global commit.template $HOME/.gitmessage.txt
Cloning into 'projectName'... error: error setting certificate verify locations: CAfile: /usr/ssl/certs/ca-bundle.crt CApath: none while accessing https://code.google.com/p/projectName/info/refs fatal: HTTP request failed
# 환경변수로 무시 export GIT_SSL_NO_VERIFY=true # 아니면 GIT 설정으로 무시 git config --global http.sslVerify false
mkdir ~/certs curl http://curl.haxx.se/ca/cacert.pem -o ~/certs/cacert.pem # ~/.gitconfig 편집 [http] sslCAinfo = /home/radium/certs/cacert.pem
default_leftonly
로 지정하면 아래 과정이 불필요하다.mkdir -p ~/.local/bin curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh -o ~/.local/bin/git-prompt.sh # edit .bashrc source ~/.local/bin/git-prompt.sh export PS1='이런저런 내용 \$(__git_ps1) 나머지 ' # 실예 녹색 프롬프트 export PS1='\[\e[1;32m\][\u@\h \W$(__git_ps1)]\$\[\e[0m\] ' # 실예 컬러 프롬프트 export PS1="\[\033[01;32m\][\[\033[01;33m\]\u\[\033[01;36m\]@\[\033[01;31m\]\h\[\033[01;37m\]:\[\033[01;34m\]\w\[\033[01;32m\]\$(__git_ps1)]\[\033[01;35m\]\\$\[\033[00m\] "
source /etc/bash_completion.d/git # or source /usr/share/bash-completion/completions/git
sudo pacman -S git bash-completion # shell 재실행
GIT_CURL_VERBOSE=1
: HTTP(S)에서 cURL 요청 주고 받는 것을 콘솔에 출력한다..git/config
파일의 Remote URL에서 username@
을 제거한다..gitignore
파일을 생성해준다..gitkeep
파일을 만들어 둔면 된다.find . -type d -empty -exec touch {}/.gitkeep \;
chmod
명령을 직접사용하면됨.git ls-files --stage
명령으로 파일 권한 확인. 보통 100644
로 돼 있음.git update-index --chmod=+x 'name-of-shell-script
' : 권한에 x
추가git ls-files --stage
로 다시 확인해보면 100755로 변경됨.