File tree Expand file tree Collapse file tree 1 file changed +55
-0
lines changed Expand file tree Collapse file tree 1 file changed +55
-0
lines changed Original file line number Diff line number Diff line change 1+ 1. CREATE YOUR SSH KEYS
2+ First you need to create your two ssh key
3+
4+ >> ssh-keygen -t rsa -C "test1@test.com"
5+ >> ssh-keygen -t rsa -f ~/.ssh/id_rsa_OTHER_LABEL -C "test2@test.com"
6+
7+ <b>Note:</b> You can use anyname for your public second key
8+
9+
10+ 2. ATTACH THE GITHUB KEYS
11+
12+ login in each github account and attach your keys respectively.
13+ What do you gonna attach ?
14+
15+ >> vim ~/.ssh/id_rsa[YOUR_NAME].pub
16+ copy and paste into the public key field at github page
17+
18+ 3. CREATE A CONFIG FILE
19+ Well, we create two differents ssh keys and attach respectively in github.
20+ Now, we have to create a way to identify the differents github accounts.
21+
22+ Create a config file
23+ >> touch ~/.ssh/config
24+ >> vim ~/.ssh/config
25+
26+ example:
27+
28+ #Default GitHub
29+ Host github.com
30+ HostName github.com
31+ User git
32+ IdentityFile ~/.ssh/id_rsa
33+ #Default GitHub
34+ Host github-company
35+ HostName github.com
36+ User git
37+ IdentityFile ~/.ssh/id_rsa_OTHER_LABEL
38+
39+ and save the changes.
40+
41+ 4. HOW IT WORKS?
42+
43+ Now, if you wanna create new project, you have to specify the HOST name in the
44+ add remote origin step change.
45+
46+ Example
47+ git init
48+ git commit -m"firt commit"
49+ #now if you use your first one ( normal github )
50+ git remote add origin git@github.com:Company/testing.git
51+ #instead it you want to use the other user just change the HOST name
52+ git remote add origin git@github-COMPANY:Company/testing.git
53+
54+ :)
55+
You can’t perform that action at this time.
0 commit comments