简体   繁体   中英

How do I configure git to do push with my user to GitHub?

When I do commits and push from command line, git push that commit to github but that commit it's not from my github user. When I do it from intellij github requires username and password and all commits are linked to my account. How can I configure it ?

I found this example here :

$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com

You'll also need to set up an SSH key on your local machine. Here's how to get that done.

Use the ssh/git protocol and you will not to use password any more.

Here is how to set it up:

  • Generate a new ssh key (or skip this step if you already have a key)
    ssh-keygen -t rsa -C "your@email"

  • Once you have your key set in home/.ssh directory (or Users/<your user>.ssh under windows), open it and copy the content


How to add sh key to github account?

  • Login to github account
  • Click on the rancher on the top right (Settings)
    在此处输入图片说明
  • Click on the SSH keys
    在此处输入图片说明
  • Click on the Add ssh key
    在此处输入图片说明
  • Paste your key and save

And you all set to go :-)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM