NOTE

1.3 Git

Git installation, SSH, user configuration, proxy settings, and GitHub SSH connectivity.

Developer ToolsCreated Updated 1 min readhistorical

This is a historical learning note and may contain outdated or incomplete understanding.

1. Install Git

2. Configure SSH

ssh.md

3. Configure Git

3.1. Username

git config --global user.name "<NAME>"
git config --global user.email "<EMAIL>"

3.2. Optional

3.2.1. Replace HTTPS with SSH

If you want to rewrite GitHub HTTPS addresses uniformly as SSH addresses, use:

git config --global url."git@github.com:".insteadOf "https://github.com/"

The git:// / email form in the original note is not the correct form for a GitHub SSH remote.

3.2.2. HTTP Proxy

Configure this only when a local proxy is actually needed, for example:

git config --global http.proxy http://127.0.0.1:<PROXY_PORT>
git config --global https.proxy http://127.0.0.1:<PROXY_PORT>

When a proxy is no longer needed, remove the corresponding configuration instead of keeping an invalid port configured permanently.

4. View Git Configuration

git config --global --list

You can also view ~/.gitconfig:

[user]
    email = <EMAIL>
    name = <NAME>
[url "git@github.com:"]
    insteadOf = https://github.com/

Add proxy settings and other machine-specific configuration according to the actual environment.

5. GitHub

  1. Add the SSH public key, for example ~/.ssh/id_ed25519.pub, to GitHub.
  2. Test the connection:
ssh -T git@github.com
# On success, you will see:
# Hi USERNAME! You've successfully authenticated, but GitHub does not provide shell access.

6. References

Discussion

Sign in with GitHub to comment. Discussions are stored as GitHub Issues.View on GitHub