关于ubuntu下git ssh key重设的一些东东

来源:互联网 发布:农村淘宝运营方案模板 编辑:程序博客网 时间:2024/06/05 18:27
  1. Check for SSH keys. Have an existing key pair? You can skip to Step 4.

    First, we need to check for existing ssh keys on your computer:

    $ cd ~/.ssh

    If it says “No such file or directory“ skip to step 3. Otherwise continue to step 2.

  2. Backup and remove existing SSH keys.

    Since there is already an SSH directory you’ll want to back the old one up and remove it:

    $ ls $ mkdir key_backup $ cp id_rsa* key_backup $ rm id_rsa*
  3. Generate a new SSH key.

    To generate a new SSH key, enter the code below. We want the default settings so when asked to enter a file in which to save the key, just press enter.

    $ ssh-keygen -t rsa -C "your_email@youremail.com"

    Now you need to enter a passphrase.

    Why do passphrases matter?

    Which should give you something like this:

  4. Add your SSH key to GitHub.

    On the GitHub site Click “Account Settings” > Click “SSH Keys” > Click “Add SSH key”


    Open the id_rsa.pub file with a text editor (Notepad, TextEdit, or gedit will do just fine). This is your public SSH key. You may need to turn on “view hidden files” to find it because the .ssh directory is hidden. It’s important you copy your SSH key exactly as it is written without adding any newlines or whitespace. Now paste it into the “Key” field.

    Can’t view hidden files? Other ways to copy:

    Now paste it into the “Key” field.

    Hit “Add Key.”

  5. Test everything out.

    To make sure everything is working you’ll now SSH to GitHub. Don’t change the “git@github.com” part. That’s supposed to be there.

    $ ssh -T git@github.com

    Which should give you this:

    Don’t worry, this is supposed to happen. Type “yes”.

    Having problems?

Then: Set Up Your Info

Now that you have Git set up and your SSH keys entered into GitHub, it’s time to configure your personal info.

  1. Set your username and email.

    Git tracks who makes each commit by checking the user’s name and email. In addition, we use this info to associate your commits with your GitHub account. To set these, enter the code below, replacing the name and email with your own. The name should be your actual name, not your GitHub username.

    $ git config --global user.name "Firstname Lastname" $ git config --global user.email "your_email@youremail.com"

    More about user info

  2. Set your GitHub token.

    Previous versions of our API used token authentication, but we’re removing support for that soon, see our GitHub API Moving On blog post for details.

    If you are using a 3rd party tool that is asking for your token, you should contact the maintainer and ask them to update to our latest API as the old API will stop working soon.

    Please note you do not need the API Token to work with gi

0 0
原创粉丝点击