Umhlahlandlela osheshayo wokusebenzisa iGithub

Lesi sifundo siyisiqondisi esisheshayo sokufaka nokusebenzisa iGitHub. Nakhu ukuthi ungakha kanjani indawo yokugcina izinto yasendaweni, ukuthi ungaxhuma kanjani lokhu okugcina kwendawo endaweni ekude yeGithub (lapho wonke umuntu angakubona khona), ukuthi ungazenza kanjani izinguquko, futhi ekugcineni ukuthi ukuphusha kanjani konke okuqukethwe okuyisizinda ku-GitHub, phakathi kweminye imisebenzi ejwayelekile. .

Ngaphambi kokuthi siqale, kubalulekile ukuthi wazi ukuthi lesi sifundo sithatha ukuqonda okuyisisekelo kwamagama asetshenziswe ku-Git: Push, donsa, bopha, gcina, njll. Iphinde idinga ukubhaliswa kwangaphambilini ku- GitHub.

Ukufakwa kwe-Github

Ku-Debian / Ubuntu nokuphuma kokunye:

sudo apt-get ukufaka git

En Fedora kanye nokuphuma kokunye:

sudo yum ufake i-git

En Arch kanye nokuphuma kokunye:

Sudo pacman -S git

Ukusetha kokuqala kwe-Github

Lapho ukufakwa sekuqede ngempumelelo, isinyathelo esilandelayo ukulungisa imininingwane yokumiswa komsebenzisi we-GitHub. Ukwenza lokhu, sebenzisa imiyalo elandelayo, ufake igama lomsebenzisi le- "GitHub" negama lakho lomsebenzisi le- "email_id" ufake ikheli le-imeyili elisetshenziselwe ukudala i-akhawunti yeGitHub.

git config --global user.name "igama lomsebenzisi" git config --global user.email "email_id"

Dala ikhosombe lasendaweni

Into yokuqala ukudala ifolda kukhompyutha yakho, ezosebenza njengendawo yokugcina yendawo. Ukuze wenze lokhu, vele usebenzise umyalo olandelayo:

git init Mytest

Lo myalo udala ifolda ye-MyTest. Ngokulandelayo, ifolda engaphansi kwe- .init yenza iMyTest ibonakale njengendawo yokugcina yamaGit yendawo.

Uma ikhosombe lakhiwe ngempumelelo, kuzobonakala umugqa ofana nalokhu okulandelayo:

Iqalise indawo yokugcina engenalutho yeGit ku /home/tu_usuario/Mytest/.git/

Ngemuva kwalokho, kufanele uye kufolda ye-MyTest:

cd Mytest

Dala ifayela le-README ukuchaza okugciniwe

Ifayela le-README livame ukusetshenziselwa ukuchaza ukuthi yini okugcinwe kuyo noma ukuthi iphrojekthi imayelana nani. Ukwakha eyodwa, vele usebenzise:

gedit README

Lapho usufake incazelo yokugcina, ungakhohlwa ukugcina izinguquko zakho.

Ukungeza amafayela wokugcina enkombeni

Lesi yisinyathelo esibalulekile. Ngaphambi kokuthi ulayishe izinguquko zakho ku-Github noma kwenye iseva ehambelana neGit, kufanele ukhombe wonke amafayela aqukethwe endaweni yokugcina izinto yasendaweni. Le nkomba izoqukatha amafayela amasha kanye nezinguquko kumafayela akhona endaweni yokugcina yendawo.

Kithina, indawo yethu yokugcina yendawo isivele inefayela elisha: i-README. Ngakho-ke, sizokwakha elinye ifayela ngohlelo olulula lweC futhi esizolibiza ngokuthi example.c. Okuqukethwe kwayo kuzoba:

#include int main () {printf ("hello world"); buyela 0; }

Ngakho-ke manje sinamafayela ama-2 endaweni yethu yokugcina yendawo: README kanye ne- example.c.

Isinyathelo esilandelayo ukufaka lawa mafayela enkombeni:

git engeza i-README git add smaple.c

Umyalo we- "git add" ungasetshenziswa ukwengeza noma iyiphi inombolo yamafayela namafolda enkombeni. Ukufaka zonke izinguquko, ngaphandle kokucacisa igama lamafayela, kungenzeka ukukhipha i- "git add." (nenkathi ekugcineni).

Gcina izinguquko ezenziwe enkombeni

Lapho wonke amafayela esefakiwe, kungenzeka ushiye irekhodi lalezi zinguquko ngokwenza lokho kugargon okubizwa ngokuthi "ukuzibophezela". Lokhu kusho ukuthi ukufaka noma ukuguqula amafayela kuqediwe futhi izinguquko zingalayishwa endaweni ekude yeGithub. Ukuze wenze lokhu, kufanele usebenzise umyalo olandelayo:

git commit -m "message"

"Umlayezo" kungaba noma yimuphi umlayezo ochaza kafushane ushintsho okukhulunywa ngalo, isibonelo: "Ngingeze ukusebenza okunjalo" noma "ngiyilungisile into enjalo", njalonjalo.

Dala ikhosombe ku-GitHub

Igama lokugcina kufanele lifane nendawo yokugcina ohlelweni lwendawo. Kulokhu, kuzoba yi- "MyTest". Ukuze wenze lokhu, okokuqala, kufanele ungene ngemvume ku- I-Github. Ngemuva kwalokho, chofoza uphawu lokuhlanganisa (+) ekhoneni eliphezulu kwesokudla sekhasi bese ukhetha inketho ethi "dala indawo yokugcina entsha". Ekugcineni, kufanele ugcwalise idatha bese uqhafaza kunkinobho ethi "dala indawo yokugcina".

Lapho lokhu sekwenziwe, indawo yokugcina izokwakhiwa futhi kuzokwazi ukulayishwa okuqukethwe okugcinwe endaweni yokugcina yamaGitHub. Ukuxhuma endaweni yokugcina ekude ku-GitHub kufanele usebenzise umyalo:

git engeza imvelaphi https://github.com/user_name/Mytest.git

Ungakhohlwa ukufaka esikhundleni 'igama lomsebenzisi' ne 'MyTest' ngegama lakho lomsebenzisi elihambisanayo nefolda.

Cindezela amafayela asuka ekhosombe lasendaweni aye endaweni yokugcina izinto zeGitHub

Isinyathelo sokugcina ukucindezela okuqukethwe yikhosombe lasendaweni endaweni ekude, usebenzisa umyalo:

git push origin master

Kusala ukufaka imininingwane yokungena (igama lomsebenzisi nephasiwedi).

Lokhu kuzolayisha konke okuqukethwe yifolda ye-MyTest (indawo yasendaweni) ku-GitHub (indawo yangaphandle). Kumaphrojekthi alandelayo, awusadingi ukulandela lezi zinyathelo kusuka ekuqaleni. Esikhundleni salokho, ungaqala kusuka kusinyathelo 3 ngqo. Okokugcina, ungakhohlwa ukuthi izinguquko zizotholakala kuwebhusayithi yeGithub.

Ukwakha igatsha

Lapho abathuthukisi befuna ukulungisa izimbungulu noma ukufaka izici ezintsha bavame ukudala igatsha noma ikhophi lekhodi ukuze bazinikele ngokwehlukana, ngaphandle kokuthinta iphrojekthi yangempela. Lapho-ke lapho sebeqedile bangahlanganisa leli gatsha libuyele egatsheni elikhulu (master).

Ukwakha igatsha elisha kunezinketho ezimbili:

Inketho ende:

git branch mirama # create a new branch called mirama git checkout mirama - switch to using the mirama branch.

Inketho emfushane:

ukuphuma kwe-git -b mirama - dala bese ushintshela ekusebenziseni igatsha le-mirama

Lapho izinguquko sezenziwe, zifake enkombeni yegatsha bese wenza ukuzibophezela okuhambisanayo:

git engeza. git commit -m "changes to mirama"

Ngemuva kwalokho, kufanele ubuyele egatsheni elikhulu uthathe izinguquko ezenziwe ku-mirama:

git checkout master git merge mirama

Ekugcineni, kufanele ususe i-mirama (ngoba ushintsho lufakiwe ku-master):

git branch -d mirama

Futhi ulayishe okuyinhloko ku-Github:

git push origin master

Ukwakha indawo yokugcina etholakalayo yeGit (imfoloko)

Ngenxa yeGit kanye nokuba khona kwemitapo yolwazi emikhulu yomphakathi, njengeGithub, isikhathi esiningi akudingekile ukuqala ukuhlela iphrojekthi yethu kusuka ekuqaleni. Kulezo zimo, kungenzeka ukuthatha le khodi eyisisekelo ukudala iphrojekthi entsha.

Ukwenza lokhu, into yokuqala okufanele uyenze imfoloko yendawo yokugcina ekhona, okungukuthi, iphrojekthi ethathwe kuyo ngokususelwa kukhodi yephrojekthi yokuqala. KuGithub, lokhu kutholakala ngokuchofoza inkinobho ehambisanayo, njengoba kuboniswe kusikrini esingezansi.

Imfoloko Yendawo Yokugcina IGithub

Ngemuva kwalokho, okufanele sikwenze ukuhlanganisa indawo yokugcina yale phrojekthi entsha kukhompyutha yethu. Njengesibonelo, singasebenzisa ikhosombe lami le-Ankifox, isandiso seFirefox esivumela ukungeza amagama ku- Anki, etholakala ku-Github:

i-git clone https://github.com/usemoslinux/Ankifox.git

Ungakhohlwa ukufaka esikhundleni se-https: //github.com/usemoslinux/Ankifox.git nge-URL ehambelana nephrojekthi yakho. Ukuthola leli kheli kulula kakhulu, njengoba kuboniswe esithombeni esingezansi.

Ukwenza i-Github Repository

Lo myalo uzokwakha umkhombandlela obizwa nge- «Ankifox», uzoqala umkhombandlela we-.git ngaphakathi kwawo, futhi uzolanda yonke idatha kusuka kuleyo khosombe, ukuze usebenze ngenguqulo yakamuva.


Okuqukethwe yi-athikili kunamathela ezimisweni zethu ze izimiso zokuhlelela. Ukubika iphutha chofoza lapha.

Amazwana ayi-22, shiya okwakho

Shiya umbono wakho

Ikheli lakho le ngeke ishicilelwe. Ezidingekayo ibhalwe nge *

*

*

  1. Ubhekele imininingwane: Miguel Ángel Gatón
  2. Inhloso yedatha: Lawula Ugaxekile, ukuphathwa kwamazwana.
  3. Ukusemthethweni: Imvume yakho
  4. Ukuxhumana kwemininingwane: Imininingwane ngeke idluliselwe kubantu besithathu ngaphandle kwesibopho esisemthethweni.
  5. Isitoreji sedatha: Idatabase ebanjwe yi-Occentus Networks (EU)
  6. Amalungelo: Nganoma yisiphi isikhathi ungakhawulela, uthole futhi ususe imininingwane yakho.

  1.   UVictor Martinez kusho

    Into efana naleyo ebengiyifuna, umhlahlandlela olula futhi osebenzayo ozochaza konke igxathu negxathu.
    Okwe-bibucket, ngicabanga ukuthi kungaba yizinyathelo ezifanayo, akunjalo?

    1.    masisebenzise i-linux kusho

      Impela. Kufana kakhulu. Vele ushintshe i-URL yesikhungo esikude.
      Into ethokozisayo ngeBitbucket ukuthi inikela ngamathuba okwenza izinqolobane eziyimfihlo (okungukuthi, ayivulelekile emphakathini jikelele kepha itholakala kuphela eqenjini elithile labantu). Ku-Github lokhu kungenzeka futhi, kepha kufanele ukhokhe. Ngakolunye uhlangothi, ku-Bitbucket no.
      Halala! UPaul.

  2.   UJonathan Diaz kusho

    Abangane Abakhulu !!! Ngezikhala ezinhle kakhulu ngaphakathi ukuze uthole futhi ufunde,

    1.    masisebenzise i-linux kusho
  3.   izinga kusho

    Ngiyabonga ngithanda iBitbucket ngaphezulu .. vele i-athikili enhle 😀

  4.   NEX kusho

    @usemoslinux Ungayakha i- "GitHub" ukufaka ngokuzenzakalela isistimu yeFreeBSD?

    I-PS: umhlahlandlela weGitHub weFreeBSD ungaba muhle.

  5.   ujosep m. fernandez kusho

    Ngibonga umhlahlandlela. Ngiyayilandela futhi benginenkinga encane, ngeke ingivumele ngilayishe okugciniwe kwasendaweni kokude. Inginika iphutha elilandelayo:

    [impande @ iou Mytest] #git Push Origin master
    iphutha: I-URL eceliwe ibuyise iphutha: 403 Akuvunyelwe ngenkathi kufinyelelwa https://github.com/miusuario/Mytest.git/info/refs

    Noma yimuphi umqondo?

    1.    masisebenzise i-linux kusho

      Mhlawumbe okwenzekayo ukuthi i-URL yendawo yokugcina ekude oyifakayo ayilungile. Lokhu kungahle kube ngenxa ye-typo lapho ufaka i-URL noma awuzange empeleni wenze ikhosombe ku-Github (ngekhasi labo lewebhu).

      Uma umlayezo wephutha ufana ncamashi nalowo owubonisayo, ubulahlekile shintsha u- "myuser" wegama lakho lomsebenzisi.

      Faka i-git remote -v ukubona ama-URL efakiwe. Ukuyiguqula, vele ubeke i-git remote set-url Origin URLNEW

      Ukufaka i-URLNEW nge-URL efanele.

      Okokugcina, ungakhohlwa ukuthi i-URL iyazwela ngamacala.

      Halala! UPaul.

  6.   Tesla kusho

    Kuyamangalisa!

    Kuchaziwe ukuze nalabo abangenalwazi oluningi kule ndaba, njengami, bayiqonde futhi bathathe izinyathelo zethu zokuqala ku-git noma eGithub. Manje amagama amaningi afana nePush, donsa noma ukuzibophezela acacile kimi.

    Siyabonga!

    1.    masisebenzise i-linux kusho

      Kwakuwumbono! Ngiyajabula!
      Ukugona nokubonga ngokushiya amazwana akho! UPaul.

  7.   Isitatimende kusho

    genial

    Umbuzo njengoba ngisusa amafayela engingasawadingi endaweni yasendaweni naseGithub

  8.   Isitatimende kusho

    Ngilungisa ukungabaza kwami ​​ukususa izinkomba ngamafayela aphelele

    umkhombandlela we-git rm -rf

    noma njengoba ???

    1.    masisebenzise i-linux kusho

      Ukususa amafayela:
      git rm file1.txt

      Ukususa izinkomba (nokuqukethwe):
      git rm -r umkhombandlela wami

  9.   Isitatimende kusho

    Ngakuthola kubukeka, ngiyabonga kakhulu

  10.   UVictor mansilla kusho

    Ngiyisebenzisa kanjani iGitlab?
    Okungenani, ku-elementaryOS ayikwazi ukuqeda ukucushwa ...

  11.   Isitatimende kusho

    Leli phutha livela lapho ngifuna ukwenza ifayela le-

    git pull Origin master

    http://i.imgur.com/fy5Jxvs.png

    1.    masisebenzise i-linux kusho

      Njengoba kuchaziwe kusithombe-skrini owabelana ngaso, kunezinguquko kuseva ezingafakiwe enguqulweni egcinwe kukhompyutha yakho. Ngokulandelayo kunezinguquko kukhompyutha yakho ezingekho kuseva (okuyizo ofuna ukuzilayisha). Ngakho-ke ukungqubuzana.

      Zama ukwenza i-git donsa kuqala njengoba kusikiselwe kusithombe-skrini.

  12.   Jose kusho

    Ngiyabonga ngosizo, imininingwane enhle kakhulu, ngizoyisebenzisa, ngiyabonga futhi

  13.   Alonso kusho

    Esigabeni: "Cindezela amafayela asuka endaweni egcinwe endaweni eya eGitHub repository"
    , ungafunda:
    Lokhu kuzolayisha konke okuqukethwe yifolda ye-MyTest (indawo yasendaweni) ku-GitHub (indawo yangaphandle). Kumaphrojekthi alandelayo, awusadingi ukulandela lezi zinyathelo kusuka ekuqaleni. Esikhundleni salokho, ungaqala kusuka kusinyathelo 3 ngqo. »

    Ngiqala kulokhu kusuka kuGit. Ungangitshela ukuthi siyini "isinyathelo 3"?

    Ngaphezu kwalokho, imiyalo:
    git config –global user.name "igama lomsebenzisi"
    git config –global user.email "email_id"

    Ngabe zidinga ukwenziwa kuzo zonke izikhathi ze-Git?

    Ngokufanayo, umyalo:
    git init "igama lefolda"
    Ngabe kunesidingo ukuyiqhuba esimisweni ngasinye somsebenzi ngeGit noma indawo yokugcina ekhulunywa ngayo, kwenzekani lapho nginezinqolobane ezimbili noma ngaphezulu?

    Ama-tutorials amahle, ukuhalalisela, ukubonga nokubingelela.

  14.   sergio kusho

    Ngiqonde kahle, kubuhlungu ukuthi alikho iklayenti le-GUI elifana neWindows / Mac: /

  15.   Sonia kusho

    Ngize lapha ukuxazulula inkinga engiyithola ku: fatal: Not a git repository (noma enye yezinkomba zabazali):. Git Ngabe lo mhlahlandlela uxazululiwe ??? ngiyabonga kusengaphambili 🙂

  16.   i-alexander kusho

    Igama lomsebenzisi le - 'https://github.com': «royalAlexander»
    Iphasiwedi ye 'https: // »royalAlexander» @ github.com':
    irimothi: Igama lomsebenzisi noma iphasiwedi engavumelekile.
    okubulalayo: Ukufakazela ubuqiniso kwehlulekile 'https://github.com/royalSanity/Mytest.git/'

    ngisize