Github-veiledning: Du må vite disse grunnleggende
I denne opplæringen vil vi introdusere deg for Github. Github er en plattform der du kan administrere, lagre og følge Git-prosjekter og brukere.
Github tutorial: hva er git?
Før du kan forstå hva Github er, må du først forstå konseptet med Git:
- Git er en versjonsstyringsprogramvare for prosjekter. Du kan bruke den til å bare hoppe tilbake til gamle boder eller jobbe på et prosjekt med flere personer.
- Du kan enten bruke Git på kommandolinjen i operativsystemet ditt eller i Github Desktop, en Git-klient med et grafisk brukergrensesnitt. Du må kjenne følgende kommandoer når du bruker Git:
- git klone [URL]: Klon et Git-lager fra URL-en til din lokale datamaskin.
- git init: Initier et Git-prosjekt lokalt. Du kan eventuelt laste dette senere på Github eller en annen vert.
- git add: Legg filer til overvåkningslisten. Dette trinnet er obligatorisk for deretter å laste opp arbeidet ditt til depotet.
- git commit: begår endringene. Dette er en stand som du kan gå tilbake til når som helst. Forplikt filer før de kan sendes til et eksternt lagringssted.
- git push: Med et trykk sender du alle forpliktelser til det eksterne depotet på serverne til Github eller den valgte andre leverandøren.
Opplæring: hva er github?
Github er verten for dine Git-prosjekter og har lignende egenskaper som et sosialt nettverk.
- Med Git kan du få tilgang til prosjektene dine som er lagret i Github hvor som helst.
- Depoter lagret i Github er alltid offentlige. Så andre brukere kan se prosjektene dine. Privat depot er bare tilgjengelig for en månedlig avgift.
- Du kan også bidra til eksisterende programmer ved å fikse feil og delta aktivt i open source-verktøy.
- Github brukes mest til omfattende prosjekter på visse programmeringsspråk. Det er imidlertid også mulig å administrere enkle dokumenter i Github.
Opplæring: Sette opp Git og Github
Før du kan starte med Git og Github, trenger du en Github-konto og må installere Git lokalt. Slik gjør du:
- Opprett først en konto på Github. Dette er ganske greit og kan gjøres raskt og enkelt.
- For å bruke Github produktivt, trenger du nå Git på din lokale datamaskin.
- Installer nå Git. Velg installasjonsprogrammet du trenger for operativsystemet.
- Start Git Bash du nettopp har installert på Windows. Start den normale terminalen på macOS og Linux.
- Med 'git config - lokalt brukernavn' [Navn] '' må du nå definere navnet ditt.
- Bruk som git config - global user.email "[Mail]" 'for å angi e-postadressen din. Bruk den samme e-posten her som du spesifiserte i Github.
Github Tutorial: Sett opp depot
Hvis du vil starte med et prosjekt, kan du opprette et depot på to måter:
- I Github, klikk på den lille boken ved siden av brukernavnet ditt for å lage et nytt depot.
- Gi prosjektet ditt et navn her. Som beskrevet over, må du offentliggjøre prosjektet eller betale en månedlig avgift.
- Klikk deretter på den grønne knappen "Lag depot". Du kan deretter legge til depotet lokalt ved hjelp av git-klon som beskrevet ovenfor.
- Lag et depot lokalt med git init. Du kan deretter koble en lokal og en online repo med 'git remote add origin //github.com/??Username Gm//Projektnavn Chapter.git').
- Du har nå et online depot på Github, slik at du kan administrere prosjektene dine og bruke dem hvor som helst.
Du kan lese om hvordan du bruker markering for readme i Github i det neste praktiske tipset.