Git GitLab Introduction
In this page:
git remote add origin https://gitlab.com/user/repo.git
git clone https://gitlab.com/user/repo.git
GitLab क्या है?
GitLab integrated DevOps tooling के आसपास बना एक web-based Git repository host है, खासतौर पर अपने खुद के CI/CD pipelines, issue tracking, और container registry, सब एक product में। आप एक local repository को इससे उसी git remote add workflow से connect करते हैं जो आप किसी दूसरे host के लिए इस्तेमाल करते, इसलिए आपके everyday Git commands में कुछ नहीं बदलता।
उदाहरण: What is GitLab?
git remote add origin https://gitlab.com/user/repo.git
GitLab से Clone करना
एक GitLab project clone करना HTTPS (username/password या personal access token पूछता है) या SSH (आपके account पर registered एक key pair इस्तेमाल करता है, कोई password prompt नहीं) दोनों पर काम करता है। एक बार cloned होने पर, project किसी भी local Git repository जैसा behave करता है — GitLab सिर्फ तभी फिर मायने रखता है जब आप push, pull, या एक merge request खोलें।
उदाहरण: Cloning from GitLab
git clone https://gitlab.com/user/repo.git
git clone [email protected]:user/repo.git
GitLab CI/CD Basics
आपके project root पर एक .gitlab-ci.yml file एक या ज़्यादा pipeline stages (build, test, deploy) define करती है जिन्हें GitLab हर push पर automatically चलाता है। यही एक team को एक टूटी हुई build या failing test को एक commit के मिनटों के अंदर पकड़ने देता है, इसे बाद में एक manual release के दौरान discover करने के बजाय।
उदाहरण: GitLab CI/CD Basics
echo "stages:\n - build\n - test\n - deploy" > .gitlab-ci.yml
Merge Requests के साथ काम करना
GitLab का Merge Request functionally GitHub के Pull Request जैसा ही idea है: एक feature branch push करें, फिर merge करने से पहले review comments और approval rules की gunjaish के साथ इसे एक target branch में merge करने की माँग वाला एक request खोलें। renamed term दोनों platforms के बीच switch करने वाले लोगों को confuse करता है।
उदाहरण: Working with Merge Requests
git checkout -b add-search-bar
git push -u origin add-search-bar
GitLab पर Forking
GitLab पर Forking किसी project (इसकी पूरी history सहित) को आपके अपने namespace में copy करता है, ताकि आप original पर write access की ज़रूरत के बिना changes कर सकें। फिर आप अपने fork में commits push करते हैं और source project को वापस एक merge request खोलते हैं, जो किसी ऐसी repository में contribute करने का standard workflow है जो आपकी नहीं है।
उदाहरण: Forking on GitLab
git clone https://gitlab.com/yourname/repo.git
git push origin main
- HTTPS पर अपना GitLab account password इस्तेमाल करना जब एक personal access token या SSH key चाहिए हो।
- leading dot के बिना pipeline file को
gitlab-ci.ymlनाम देना, ताकि GitLab कोई pipeline न चलाए; इसे.gitlab-ci.ymlहोना ज़रूरी है। - यह मान लेना कि बिना किसी configuration के GitLab CI किसी भी push पर चलता है, जबकि jobs सिर्फ तभी चलती हैं जब
.gitlab-ci.ymlfile उन्हें define करे।
Chapter Quiz — Complete all 11 topics to unlock
0/11 topics done
Complete these topics first: