Skip to content

Instantly share code, notes, and snippets.

@NateWeiler
Created December 15, 2020 12:53
Show Gist options
  • Save NateWeiler/a1b3cd55dfec561c1d272b11cd146484 to your computer and use it in GitHub Desktop.
Save NateWeiler/a1b3cd55dfec561c1d272b11cd146484 to your computer and use it in GitHub Desktop.
How to connect Git Bash to GitHub

How to connect Git Bash to GitHub

Setup github password terminal:

$ git config credential.helper store
$ git push https://github.com/owner/repo.git

Username for 'https://github.com': <USERNAME>
Password for 'https://[email protected]': <PASSWORD>

How to set up git for GitHub:

$ git config --global user.name <Your name here>
$ git config --global user.email <[email protected]>

How to setup git config file:

cd ~/.ssh
touch config
nano config

Use whatever text editor if you don't like nano.

# Github <User> account
Host github.com-<User"
HostName github.com
User git
PreferredAuthentications publickey
IdentityFile ~/.ssh/GitHub/<User"/id_rsa
AddKeysToAgent yes

# Github <User2> account
Host github.com-<User2>
HostName github.com
User git
PreferredAuthentications publickey
IdentityFile ~/.ssh/GitHub/<User2>/id_rsa
AddKeysToAgent yes

# GitLab <User> account
Host gitlab.com/<User"
HostName gitlab.com
User git
PreferredAuthentications publickey
IdentityFile ~/.ssh/GitLab/<User"/id_rsa
AddKeysToAgent yes

# GitLab <User2> account
Host gitlab.com/<User2>
HostName gitlab.com
User git
PreferredAuthentications publickey
IdentityFile ~/.ssh/GitLab/<User2>/id_rsa
AddKeysToAgent yes

@sasimf
Copy link

sasimf commented Jun 18, 2025

can i copy the above and paste it into bash if so how?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment