clone
git clone gitpath
git -c http.sslVerify=false clone https://id@githost/project/project.git
ex) git -c http.sslVerify=false clone https://id@127.0.0.1/project/project.git
update code from git server
If you're pushing to a remote repository for the first time, you may need to set the remote URL using the git remote command:
git remote add origin https://gitlab.com/your-username/your-repository.git
삭제 후 다시 다른 버전으로 돌리기
$ git reflog
버전 들
$ git reset --hard 버전
해당 버전으로 돌아간다
$ git log --oneline 으로 확인 가능
version check
git status
git branch
version change
git checkout version
pull / fetch
git pull project // project 생략 가능
git stash // 임시 저장
git fetch // 다른 버전 가져와서 작업
git stash pop // 임시 저장으로 복귀 (임시 버전 서버에서 삭제)
git stash apply // 임시 저장으로 복귀 (임시 버전은 서버에 유지)
내 변경 사항 삭제 하고 가져 오기 (아래 10. 참고)
git reset --hard
git pull
$ git status
$ git add .
$ git commit -m "message"
$ git push
rm directory .git Operation permission error
가끔 project 디렉토리를 강제로 지우고자 할 때
permission error가 나면서 안지워지는 경우가 있다
chmod -R +w .git 한다음에 지우면 된다
변경 사항 삭제
git log --oneline 으로 커밋 로그 확인
$ git log --oneline
ab43d66 (HEAD -> master) docs: Update README.md
1fd1a15 docs: Update README.md
fb58071 docs: Update README.md
git reset --hard HEAD~1 하고 로그 확인
$ git reset --hard HEAD~1
HEAD is now at 1fd1a15 docs: Update README.md
$ git log --oneline
1fd1a15 (HEAD -> master) docs: Update README.md
fb58071 docs: Update README.md
git status로 확인
$ git status
On branch master
nothing to commit, working tree clean
위에서 --hard 대신 --mixed 또는 --soft 옵션도 가능하다
--mixed는 working directory에 남는다
--soft는 파일이 stage에 유지되어 남는다
ssh credential
sudo apt-get install git-credential-manager
git config --global credential.helper manager
git config --global user.name "abc"
git config --global user.email "abc@abc.com"
ssh key generation
ssh-keygen -t rsa -b 4096 -C "paek.inhyeok@192.168.10.232"
cd ~/.ssh
cat id_rsa.pub
--> copy key and set your gitlab userid profile's security
--> in this case, server needs to run using https