Git GitHub Introduction
In this page:
git remote add origin https://github.com/user/repo.git
git clone https://github.com/user/repo.git
GitHub क्या है?
GitHub Git repositories के लिए एक web-based hosting platform है जो raw Git के ऊपर collaboration tools -- issues, pull requests, code review -- add करता है। आप एक local repository को git remote add इस्तेमाल करके किसी भी दूसरे remote जैसे ही इससे connect करते हैं।
उदाहरण: What is GitHub?
git remote add origin https://github.com/user/repo.git
GitHub से Clone करना
GitHub पर कोई भी public repository को इसके HTTPS URL या इसके SSH URL से कोई भी clone कर सकता है -- HTTPS शुरुआत में set up करना simpler है, जबकि SSH आपकी key configured होने के बाद credentials दोबारा enter करने से बचाता है।
उदाहरण: Cloning from GitHub
git clone https://github.com/user/repo.git
git clone [email protected]:user/repo.git
Forking और Pull Requests
Forking आपके GitHub account के तहत किसी और की repository की आपकी अपनी personal copy बनाता है; original को अपने fork के origin के साथ एक upstream remote की तरह add करना आपको समय के साथ original project के updates खींचते रहने देता है।
उदाहरण: Forking and Pull Requests
git remote add upstream https://github.com/original/repo.git
git fetch upstream
Personal Access Tokens
2021 से, GitHub को HTTPS पर command-line authentication के लिए आपके account password के बजाय एक Personal Access Token चाहिए -- आप इसे GitHub की settings में generate करते हैं और Git को इसे password जैसा इस्तेमाल करने के लिए configure करते हैं।
उदाहरण: Personal Access Tokens
git clone https://<token>@github.com/user/repo.git
एक मौजूदा Project Link करना
एक ऐसा project publish करने के लिए जो पहले से locally exist करता है, हमेशा की तरह git init, git add, और git commit चलाएँ, फिर GitHub पर एक empty repository बनाएँ, इसे एक remote की तरह add करें, और push करें -- GitHub को उस final push तक कभी आपका code देखने की ज़रूरत नहीं।
उदाहरण: Linking an Existing Project
git init
git add .
git commit -m "Initial commit"
git remote add origin https://github.com/user/repo.git
git push -u origin main
- Git और GitHub को confuse करना, जबकि GitHub एक hosting service है और Git tool है।
- HTTPS से clone करना और एक password माँगे जाने पर, जिसे GitHub अब accept नहीं करता; एक personal access token या SSH इस्तेमाल करें।
- एक fork की files edit करना और original repository के बदलने की उम्मीद करना, जबकि आपको एक pull request खोलना ज़रूरी है।
Chapter Quiz — Complete all 11 topics to unlock
0/11 topics done
Complete these topics first: