en:cs:git:basic:multipleaccount
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
en:cs:git:basic:multipleaccount [2025/05/03 20:43] – created ulascemh | en:cs:git:basic:multipleaccount [2025/05/04 18:46] (current) – removed ulascemh | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Using Multiple Githup Accounts on One Computer ====== | ||
- | I am writing for the Windows operating system, but the logic should work for other operating systems as well. With 5 simple steps we will be able to switch between accounts whenever we want. | ||
- | |||
- | - Generate SSH keys for all accounts | ||
- | - Adding SSH keys to SSH Agent | ||
- | - Adding SSH public keys to Githup | ||
- | - Creating setting file and preparing Host inputs | ||
- | - Using different accounts when copying Githup repos | ||
- | |||
- | ===== Generating SSH Keys for all accounts ===== | ||
- | |||
- | For Windows, you need to be in the user folder. But we don't need to worry about that since we will use the Git Bash command line. We can get things done using Unix code. | ||
- | |||
- | < | ||
- | C: | ||
- | </ | ||
- | |||
- | - Open Git Bash and type the following codes in order. | ||
- | |||
- | |||
- | <code bash> | ||
- | cd ~ | ||
- | mkdir .ssh | ||
- | # If the folder already exists, the above will give an error. If it already exists, we will use that folder. | ||
- | cd .ssh | ||
- | eval `ssh-agent -s` | ||
- | </ | ||
- | |||
- | - Create ssh keys for each account in the relevant folder using the following code. | ||
- | |||
- | <code bash> | ||
- | ssh-keygen -t rsa -C " | ||
- | </ | ||
- | |||
- | <WRAP round info> | ||
- | The '' | ||
- | </ | ||
- | |||
- | <WRAP round important> | ||
- | **Dikkat**: Burada yazacağın mail adresinde githup' | ||
- | </ | ||
- | |||
- | <WRAP center round info 60%> | ||
- | Anahtarları ekledikten sonra **.ssh** klasörü içerisinde her hesap için bir private bir public dosya oluşması lazım. | ||
- | |||
- | Public anahtar '' | ||
- | |||
- | Tüm hesapların için birer anahtar oluşturduktan sonra devam edebilirsin. | ||
- | |||
- | </ | ||
- | |||
- | ===== SSH Anahtarlarının SSH Agent' | ||
- | |||
- | Komut satırında hâla .ssh içerisindeyken aşağıdaki komutla anahtarları agent' | ||
- | |||
- | <code bash> | ||
- | ssh-add __GITHUP_KULLANICI_ADI__ | ||
- | ssh-add __GITHUP_KULLANICI_ADI__ | ||
- | </ | ||
- | |||
- | ===== SSH Public Anahtarının Githup' | ||
- | |||
- | Oluşan '' | ||
- | |||
- | [[https:// | ||
- | |||
- | ===== Config Dosyası oluşturma ve hazırlama ===== | ||
- | |||
- | - Git Bash üzerinden '' | ||
- | - Yukarıdaki kod o klasörde **config** isminde uzantısız bir dosya oluşturacaktır. O dosyayı herhangi bir metin editörü ile aç ve içerisine aşağıdakileri yapıştır. | ||
- | |||
- | <code bash> | ||
- | # | ||
- | Host github.com-__GITUP_KULLANICI_ADI__ | ||
- | HostName github.com | ||
- | User git | ||
- | IdentityFile ~/ | ||
- | |||
- | # | ||
- | Host github.com-__GITHUP_KULLANICI_ADI_2__ | ||
- | HostName github.com | ||
- | User git | ||
- | IdentityFile ~/ | ||
- | </ | ||
- | |||
- | Kullanıcı adı kısımlarını kendine göre düzenle. Sayıyı istediğin kadar arttırabilirsin. | ||
- | |||
- | ===== Githup Repolarını Farklı Hesaplar Kullanarak Klonlama ===== | ||
- | |||
- | Aşağıdaki komut ile klonlama yapabilirsin yada direkt HTTPS üzerindende klonlama yapabilirsin. | ||
- | |||
- | <code bash> | ||
- | git clone [email protected]{__GITHUP_KULLANICI_ADI__}: | ||
- | </ | ||
- | |||
- | Commitlerin hangi hesapla yapılacağını belirlemek için her repo için ayrı ayrı kullanıcı ayarları yapman gerekmekte. Global ayarlar sadece tek bir hesap için kullanılabilir. Tüm var olan repolarına ve gelecekte klonlayacağın repolarında her zaman aşağıdaki işlemleri yap. | ||
- | |||
- | <code bash> | ||
- | git config user.email " | ||
- | git config user.name " | ||
- | |||
- | git config user.email " | ||
- | git config user.name " | ||
- | </ | ||
- | |||
- | Elbette sayıyı arttırabilirsin. | ||
- | |||
- | Son olarak **pull** ve **push** kullanabilmek için remote origin eklememiz gerekmekte. Aşağıdaki komutu her repon için çalıştır. | ||
- | |||
- | <code bash> | ||
- | git remote add origin [email protected]__GITHUP_KULLANICI_ADI__: | ||
- | |||
- | git remote add origin [email protected]__GITHUP_KULLANICI_ADI_2__: | ||
- | </ | ||
- | |||
- | **Kaynak**: [[https:// | ||
- | |||
- | |||
- | <wrap onlyprint> | ||
- | <wrap hide> | ||
- | ===== NOTLAR ===== | ||
- | Kaynak gösterme kısmı için düzenleme yapıldığında burası düzenlenecek. | ||
- | </ |
en/cs/git/basic/multipleaccount.1746305009.txt.gz · Last modified: 2025/05/03 20:43 by ulascemh