$ ssh-keygen -t rsa -C "mailwp@163.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/wupeng/.ssh/id_rsa):
Created directory '/Users/wupeng/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/wupeng/.ssh/id_rsa.
Your public key has been saved in /Users/wupeng/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:mBQBlr4W+G78Gm7tiBnq380bmF3ZCKz2DJ2RH2FKVnQ mailwp@163.com
The key's randomart image is:
+---[RSA 2048]----+
| ooo+o= E |
| .. +.+ o |
| o .* . |
| . o.oo= = |
| . *ooS= . |
| = B . |
| .+.+ = |
| . =*o+ . |
|o.+++=o+. |
+----[SHA256]-----+
$ cat .ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQMEH7t4reNpWeewmZzxxiehLxg2+LEhwUvr6BseVPpEMOsWtgdA08bIifBRi+MRBbOEmUm7/rj7b/64uuCojqxKMdkhA/YfpldGx+PB8Lug9XF8NMILVQ+pXG+aWHiSFNom7Tj5p4/XDX4g0caAo+9FmVRWKt3LRea5ohLBHM7+hRkCQ1kOefXIitkGItml5uA37L5WY3s9ClyaHdCSnO37vY+BCdS+bB8dphys/+MQP6eF4V4pNfOdcxLDbH0ZNF11js7Q0faOPzRQFFdDES3K/3MwM0J+hHgWrEOh9dz0WS4VzRM81s0vduCQuyXfgV9i1ewscUe+MeB2H1ru6x mailwp@163.com
$ git config --global user.name "lupinwu"
$ git config --global user.email "mailwp@163.com"
$ cat ~/.gitconfig
[user]
name = lupinwu
email = mailwp@163.com
$ mkdir mac-github-test
$ cd mac-github-test/
$ git init
Initialized empty Git repository in /Users/wupeng/GitHub/mac-github-test/.git/
$ echo "test" > file1
$ ls
file1
$ git status
On branch master
Initial commit
Untracked files:
(use "git add <file>..." to include in what will be committed)
file1
nothing added to commit but untracked files present (use "git add" to track)
$ git add file1
$ git status
On branch master
Initial commit
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: file1
$ git commit -m "add file1"
[master (root-commit) fd72c70] add file1
1 file changed, 1 insertion(+)
create mode 100644 file1
$ git status
On branch master
nothing to commit, working tree clean
$ git remote add origin git@github.com:lupinwu/mac-test.git
$ git push -u origin master
The authenticity of host 'github.com (192.30.253.113)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': yes
Warning: Permanently added 'github.com,192.30.253.113' (RSA) to the list of known hosts.
Counting objects: 3, done.
Writing objects: 100% (3/3), 207 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
网友评论