Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Windows Tipps & SecurityGetting Repeated No Caller ID Calls? Here’s What’s Really Going On(22.09.2026 um 22:31 Uhr)
Windows Tipps & SecurityHöllenmaschine: Gaming-Peripherie für gut 1.800 Euro für die HMX 6(23.09.2026 um 10:20 Uhr)
Windows Tipps & SecurityDas nächste große Ding: KI-Agenten(23.09.2026 um 10:30 Uhr)
Sichere ProgrammierungHow AI Is Making Restaurant Menus Easier to Navigate(23.09.2026 um 10:55 Uhr)
Windows Tipps & SecurityGetting Repeated No Caller ID Calls? Here’s What’s Really Going On(22.09.2026 um 22:31 Uhr)
Windows Tipps & SecurityHöllenmaschine: Gaming-Peripherie für gut 1.800 Euro für die HMX 6(23.09.2026 um 10:20 Uhr)
Windows Tipps & SecurityDas nächste große Ding: KI-Agenten(23.09.2026 um 10:30 Uhr)
Sichere ProgrammierungHow AI Is Making Restaurant Menus Easier to Navigate(23.09.2026 um 10:55 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Managing Multiple GitHub Accounts (Without UI Interaction 😎)

If you work with both personal and work-related projects hosted on GitHub, and you’re using the same machine to work on them, configuring Git to push to the correct GitHub account can be tricky. In this article, we’ll go through the pro…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

If you work with both personal and work-related projects hosted on GitHub, and you’re using the same machine to work on them, configuring Git to push to the correct GitHub account can be tricky. In this article, we’ll go through the process of setting up your SSH keys, configuring Git settings, and ensuring your repositories use the correct account for each git push



Step 1: Generate SSH Keys for each GitHub account

GitHub uses SSH keys to authenticate you. To work with multiple GitHub accounts, you’ll need to create separate SSH keys for each account.



Commands to generate SSH keys:

Open your terminal and run the following command to generate a new SSH key for your personal GitHub account:




ssh-keygen -t ed25519 -C "[email protected]"






When prompted for a file to save the key, specify a unique name, for example:



For personal GitHub account: [recommended_path]/id_ed25519_personal

For work GitHub account: [recommended_path]/id_ed25519_work



Repeat the process for your work GitHub account, but with a different file name:




ssh-keygen -t ed25519 -C "[email protected]"






Now, instead of manually copying the SSH public key to GitHub's UI, you can automatically copy it to the clipboard using pbcopy command:



For Personal GitHub account, run:




pbcopy < ~/.ssh/id_ed25519_personal.pub






This command copies the contents of your public key directly to the clipboard.



After running this command, you can simply add the public key to GitHub:



Go to GitHub.com > Avatar > Settings > SSH and GPG Keys.



Click New SSH Key and paste the copied key (it’s already in your clipboard).



Step 2: Configure SSH to use the correct keys



Now that you have SSH keys, you need to tell your Mac which key to use for each GitHub account. This is done via the ~/.ssh/config file.




nano ~/.ssh/config






Add the following configurations for both GitHub accounts:




# Personal GitHub Account
Host github-personal
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519_personal

# Work GitHub Account
Host github-work
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519_work






These settings tell your machine to use the corresponding SSH key when you interact with GitHub based on the host name (github-personal or github-work).



Step 3: Configure Git to Use the Correct Remote URL



Instead of manually updating the remote URL by commands every time you clone a repository, we'll set this up directly in the .git/config file. This ensures you’re always using the right GitHub account for your repos.



In each of your repositories, you’ll need to update the .git/config file to point to the correct SSH host and remote URL.



Open your repository folder.

Open the .git/config file on your project folder:




nano .git/config






Add/update the [remote "origin"] section to use the correct SSH URL based on your GitHub account:



For personal projects, update the url to:




[remote "origin"]
url = git@github-personal:your-username-from-repo/your-repo.git
fetch = +refs/heads/*:refs/remotes/origin/*

[user]
name = "Your name"
email = "[email protected]"






This ensures the repository uses the correct GitHub account for pushing and pulling code.



Step 5: Verify everything is set up correctly



To ensure that everything is working as expected, you can verify the configuration with the following checks:



To verify that your SSH keys are configured correctly, test the connection with GitHub:



For your personal GitHub account, run:




ssh -T git@github-personal






Step 6: Push code to GitHub



Now that everything is set up, you can push your code to the appropriate GitHub account based on the repository configuration.



For personal projects:




git push -u origin main






Git will automatically use the correct SSH key and GitHub account, as specified in your .git/config.



Happy coding! 🚀

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Managing Multiple GitHub Accounts (Without UI Interaction 😎)

Thematisch verwandte Begriffe: Managing, Multiple, GitHub, Accounts · 6 Treffer

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-96258 | A vulnerability has been found in onSite internet GmbH Auktion NG Auktio…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick