如何实现 Github 免密码 git push 内容
Contents from Github Help.
Git Cnfig as a backup #
This part is a backup of the git config of my hugo blog.
./REPO/*
|
|
./XXX/public/
|
|
Generating a new SSH key #
- Open Git Bash.
- Paste the text below, substituting in your GitHub email address.
|
|
This creates a new ssh key, using the provided email as a label.
|
|
- When you’re prompted to “Enter a file in which to save the key,” press Enter. This accepts the default file location.
|
|
At the prompt, type a secure passphrase. For more information, see “Working with SSH key passphrases”.
|
|
Adding your SSH key to the ssh-agent #
Before adding a new SSH key to the ssh-agent to manage your keys, you should have checked for existing SSH keys and generated a new SSH key.
If you have GitHub Desktop installed, you can use it to clone repositories and not deal with SSH keys. It also comes with the Git Bash tool, which is the preferred way of running git commands on Windows.
- Ensure the ssh-agent is running:
- If you are using the Git Shell that’s installed with GitHub Desktop, the ssh-agent should be running.
- If you are using another terminal prompt, such as Git for Windows, you can use the “Auto-launching the ssh-agent” instructions in “Working with SSH key passphrases”, or start it manually:
|
|
- Add your SSH private key to the ssh-agent. If you created your key with a different name, or if you are adding an existing key that has a different name, replace id_rsa in the command with the name of your private key file.
|
|
Add the SSH key to your GitHub account #
- Copy the SSH key to your clipboard.
If your SSH key file has a different name than the example code, modify the filename to match your current setup. When copying your key, don’t add any newlines or whitespace.
|
|
Tip: If clip isn’t working, you can locate the hidden .ssh folder, open the file in your favorite text editor, and copy it to your clipboard.
In the upper-right corner of any page, click your profile photo, then click Settings.
In the user settings sidebar, click SSH and GPG keys.
Click New SSH key or Add SSH key.
In the “Title” field, add a descriptive label for the new key. For example, if you’re using a personal Mac, you might call this key “Personal MacBook Air”.
Paste your key into the “Key” field.
Click Add SSH key.
If prompted, confirm your GitHub password.
时空乱流记录