Git - Downloads
Downloads macOS Windows Linux/Unix Older releases are available and the Git source repository is on GitHub. GUI Clients Git comes with built-in GUI tools (git-gui, gitk), but there are several third-party tools for users looking for a platform-specific exp
git-scm.com
CI/CD
https://www.redhat.com/ko/topics/devops/what-is-ci-cd
CI/CD(지속적 통합/지속적 제공): 개념, 방법, 장점, 구현 과정
CI/CD는 애플리케이션의 통합 및 테스트부터 제공 및 배포까지 전체 라이프사이클에서 지속적인 자동화와 모니터링을 제공합니다. 개념, 차이점, 학습방법(인강)을 보세요.
www.redhat.com
사양에 맞춰 다운로드 한다.
가장 아래쪽의 Add a Git Bash Profile to Windows Terminal을 체크한다.
나머지는 전부 디폴트값으로 지정한다.
GitHub: Where the world builds software
GitHub is where over 83 million developers shape the future of software, together. Contribute to the open source community, manage your Git repositories, review code like a pro, track bugs and feat...
github.com
깃허브에 로그인 후, repository를 만든다.
원격 저장소인 test-dev repository를 만든다.
git-test 디렉터리를 만든 뒤 이동,
README 파일을 만들어서 저장한다.
git init으로 repository를 만든다.
config로 Username과 email을 지정해야 깃허브 내 계정으로 접근할 수 있다.
m : 메시지 남기기
커밋하기
변경사항을 다시 add 후 commit
log : 기록을 볼 수 있다.
위에 있을 수록 최신 기록이다.
git checkout
checkout으로 add update -> add site로 rollback한다.
이전 버전으로 돌아온 것을 볼 수 있다.
git checkout -
가장 최신 버전으로 돌아갈 수 있다.
Quick setup의 HTTPS 링크를 복사한다.
git remote add origin ~
원격저장소를 추가하고 이 공간에 README.txt를 올릴 수 있다.
git push origin master
그러면 Sign in이 뜬다.
Settings 클릭
Developer Settings > Personal access tokens 메뉴 클릭
Generate new token을 클릭한다.
repo 선택한 후 Generate 한다.
token이 생성되는데, 한번 노출된 이후로는 다시 볼 수 없다.
입력해서 Sign in 한다.
repository를 보면, 올라와 있다.
git clone
이 리포지토리를 다운로드 받을 수 있다.
git add . 을 하면 폴더 내의 모든 파일을 add할 수 있다.
commit 후 push 한다.
git-test 에서는 새로운 정보를 받아오지 않았기 때문에 Nihao가 추가되지 않았다.
git pull
업데이트 할 수 있다.
기존 README 파일을 삭제하고, commit 후 push 한다.
그러면 repository에 README.txt가 삭제되어 있다.
Git Lab - Linux에서
Virtual Box를 실행한 뒤, CentOS를 설치한다.
--- Git Lab 설치
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
EXTERNAL_URL="http://192.168.56.111" yum install -y gitlab-ce
moba Xterm으로 접속한 뒤, 해당 명령어를 실행해 준다.
ip는 내 vm의 Ip로 수정한다.
해당 ip로 웹사이트에 접속해본다.
cat /etc/gitlab/initial_root_password 로 비밀번호를 알 수 있다.
root로 접속한다.
접속 후 비밀번호를 바꿔준다. 맨 오른쪽 위 - Preferences - Password
변경 후 재로그인한다.
root계정에서 로그인 한 뒤
Users에서 pending approval - 사용자를 추가한다.
재로그인한 뒤, Create a project 클릭
blank project
test-project
Visibility lvel = public으로
리눅스에서 git 설치하기
yum install git
* 명령어 자동완성이 되지 않는다면 exit 후 재접속한다.
init을 통해 git repo를 관리하기 위한 로컬 저장소가 된다.
혹은 push를 통해 원격저장소에 옮길 수 있다.
checkout을 이용해 roll back을 할때 commit 아이디를 다 쓸 필요 없다.
gitlab 원격 저장소 지정
*master가 아닌 main branch이다
그냥 push를 하면 src refspec main does not match any failed to push some refs to ~ 오류가 뜨는데
pull한 후
push할 때 브랜치 앞에 HEAD를 붙이거나
혹은 설정 > repository> protected branches에서 unprotect를 클릭한다.
Windows에서 Gitlab 사용하기
Clone with HTTP 복사
로그인하면 push가 성공적으로 된다.
다시 centos로 간다.
cat README.txt 해보면 Aloha 들어가있고 nihao가 없다
git pull origin main
하고 다시 cat README.txt 해본다.
git rm README.txt
git commit -m "remove README.txt"
git push origin main