Faʻafefea ona Pulea tele GitHub Faʻamatalaga i luga o le Same Masini

I le avea ai o tagata atiaʻe, e masani ona tatou faʻataʻamilomilo tala e tele GitHub i luga o le masini e tasi. Mo se faʻataʻitaʻiga e i ai la matou lava GitHub teuga tupe mo la matou lava poloketi ma le isi GitHub teuga tupe matou te faʻaaogaina mo a matou tagata faʻatau galuega.

Lenei tusitusiga avatua laʻasaga i lea laʻasaga faʻatonuga pe faʻafefea ona setiina ma galue ma tele GitHub teuga tupe i luga o le tutusa masini.

Pulea Faʻamatalaga Sili GitHub

I lenei tulaga o le a tatou faia ai ni tala se lua GitHub eseese luga o le masini lava e tasi ma fesuiaʻi i le va o le lua.

Fausia Key SSH

Muamua, tatou manaʻomia le faia o a tatou lava / lautele SSH ki mo a tatou totino teuga tupe

E mafai ona tatou faia lenei mea e ala i le faʻatinoina o le faʻatonuga lea i se nofoaga faʻaiʻu:

$ ssh-keygen -t rsa -C 'email@gmail.com' -f 'id_rsa_personal'

O le tuatusi imeli i luga atu o le tasi e te faʻaaogaina e ulufale ai i lau oe lava GitHub teuga tupe.



A fesili mo le nofoaga e sefe ai ki, talia le le lelei nofoaga e ala i le oomi ulufale. Ua faia se paʻaga tumaoti / lautele faitele i le nofoaga ssh le masani ai ~/.ssh/.

O a matou lava ki SSH o:

~/.ssh/id_rsa_personal.pub ma ~/.ssh/id_rsa_personal

Le isi, matou fausiaina matou tumaʻoti / lautele SSH ki mo a matou tagata o tausia teuga tupe:

$ ssh-keygen -t rsa -C 'email@company.com' -f 'id_rsa_company'

O le tuatusi imeli i luga atu o le tasi e te faʻaaogaina e ulufale ai i lau tagata tautua GitHub teuga tupe.

O le faʻatonuga i luga atu e fausia ai la matou tagata tautua SSH ki i le ~/.ssh/.

O le matou client SSH ki o:

~/.ssh/id_rsa_company.pub ma ~/.ssh/id_rsa_company

Faʻaopopo SSH Keys i Faʻaaloalo GitHub Teugatupe

Alu i lau oe tala GitHub ma faʻaopopo lau id_rsa_personal.pub ki a le tagata lava ia.

Le isi, login i lau tagata o tausia GitHub teuga tupe ma faʻaopoopo oe id_rsa_company.pub tagata lautele ki

Afai e te le o mautinoa pe faʻafefea ona fai lenei, ona faitau lea faʻapipiʻi Git ma Generate SSH Keys .

Faʻafou le SSH config File

O le faila SSH config e nofo i ~/.ssh/. Afai e te le vaʻai i se faila config, ona faia lea o se tasi:

$ cd ~/.ssh/ $ touch config

// Creates the file if not exists $ nano config

// Opens the file for editing

Faʻaopopo au 'eseʻese GitHub talaʻaga i le SSH config faila:

# Personal account Host github.com-personal HostName github.com User git IdentityFile ~/.ssh/id_rsa_personal # Company account-1 Host github.com-company HostName github.com User git IdentityFile ~/.ssh/id_rsa_company

Tusi Resitala SSH Ki ma le sui sooupu

Amata lau ssh-agents i le tamoe eval '$(ssh-agent -s)'.

Ona faʻaopopo lea o au ki SSH ile ssh-agents:

ssh-add ~/.ssh/id_rsa_personal ssh-add ~/.ssh/id_rsa_company

Lenei o le a lesitalaina au SSH ki ma le ssh-sooupu luga o le masini.

Naʻo le Tasi le SSH Key e tasi ile ssh-agents ile taimi e tasi

Lea ua tatou fausia a tatou ki SSH mo ia lava ma kamupani ma resitaraina i latou ma le sui sooupu, ua mafai nei ona tatou fesuiaʻi i le va o le lua GitHub teuga tupe i luga o le tutusa masini.

E tatau ona tatou mautinoa e naʻo le SSH ki o loʻo faʻaopopoina i le ssh-agents i le taimi e tasi.

Mo se faʻataʻitaʻiga, afai o loʻo matou galulue ia matou lava poloketi matou te faia:

$ ssh-add -D

//removes all ssh entries from the ssh-agent $ ssh-add ~/.ssh/id_rsa_personal
// Adds the personal ssh key

E faʻapena foi, afai o loʻo matou galulue i le matou client client, matou te faia:

$ ssh-add -D

//removes all ssh entries from the ssh-agent $ ssh-add ~/.ssh/id_rsa_company

// Adds the company ssh key

Ma o le auala lea e mafai ai ona matou faʻatautaia le tele o tala GitHub luga o le masini e tasi ma fesuiaʻi i le va o latou ao galulue i latou lava poloketi.