3. git install note¶
2017-02-06:
已经在办公虚拟机上完成了git克隆同步的操作。
[dong@localhost learngit]$ git pull git@github.com:zhd0305/hello-world.git
执行git pull从远端下拉数据时,要先明确在什么目录下,要执行pwd命令查看当期目录,确认是准确的项目文件目录下才能执行git pull命令。
否则很容易把项目文件抓取到上级目录中!
[dong@localhost learngit]$ git clone git@github.com:zhd0305/hello-world.git
这个命令是把远程的项目文件克隆到当前目录下。
。。。
[dong@localhost ~]$ pwd
/home/dong
[dong@localhost ~]$ ssh-keygen -t rsa -C "zhd0305"
Generating public/private rsa key pair.
Enter file in which to save the key (/home/dong/.ssh/id_rsa):
Created directory '/home/dong/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/dong/.ssh/id_rsa.
Your public key has been saved in /home/dong/.ssh/id_rsa.pub.
The key fingerprint is:
ac:71:f8:c3:a9:20:78:78:75:3d:e2:3a:18:81:57:38 zhd0305
The key's randomart image is:
+--[ RSA 2048]----+
| . |
| E . |
| . o |
|. o + |
| . .. = S |
| o.. o B o |
|o +o. o = |
| o...o . . |
| ... |
+-----------------+
[dong@localhost ~]$ ls
a.out Documents hello.c Pictures Templates test2.c test.c
Desktop Downloads Music Public test test3.c Videos
[dong@localhost ~]$ ls ./.ssh
id_rsa id_rsa.pub
[dong@localhost ~]$ more ./.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCzBUaBjdhCmm7t2sbe0get9K05ogUtXCzn
klO5EfhiUpmpg8khsblubTtI93VuxB7iLMZ2NIF5suYH4y23rqJRzPdX/ePDBNBwCFqAKIRq
stJBzok125Xh+Ma+unlKAFqI4LEwWxzEg4So9RWq+wO8LAfVYezYcDpo6C23ZiNVj1J9dVAJ
WKlelhnYctOYsTYxW/Hl0P9GPQIQl68A/ayO/VUSk58Y1/WPAdg7jrV3v498FJYgBEeiD95V
jv2LLcOBINBXkooKVMqpsKUbZHBQP8Xc/uKoFSIFLjKvrIUCxVsgOz12u2cYR3JfJJfWXLj5
jJYthYQFkvXxILVXdSQ7 zhd0305
[dong@localhost ~]$
[dong@localhost ~]$ ll
total 40
-rwxrwxr-x. 1 dong dong 8555 Jan 22 09:58 a.out
drwxr-xr-x. 2 dong dong 6 Sep 3 16:40 Desktop
drwxrwxr-x. 2 dong dong 34 Feb 5 10:58 docs
drwxr-xr-x. 2 dong dong 6 Sep 3 16:40 Documents
drwxr-xr-x. 2 dong dong 52 Feb 4 14:39 Downloads
-rw-rw-r--. 1 dong dong 59 Jan 17 22:09 hello.c
drwxr-xr-x. 2 dong dong 6 Sep 3 16:40 Music
drwxr-xr-x. 2 dong dong 6 Sep 3 16:40 Pictures
drwxr-xr-x. 2 dong dong 6 Sep 3 16:40 Public
drwxr-xr-x. 2 dong dong 6 Sep 3 16:40 Templates
-rwxrwxr-x. 1 dong dong 8502 Jan 17 13:02 test
-rw-r--r--. 1 root root 275 Jan 21 15:10 test2.c
-rw-rw-r--. 1 dong dong 334 Jan 22 09:58 test3.c
-rw-rw-r--. 1 dong dong 67 Jan 21 14:24 test.c
drwxr-xr-x. 2 dong dong 6 Sep 3 16:40 Videos
[dong@localhost ~]$ mkdir learngit [dong@localhost ~]$ cd learngit/
[dong@localhost learngit]$ pwd /home/dong/learngit
[dong@localhost learngit]$ git init Initialized empty Git repository in /home/dong/learngit/.git/ [dong@localhost learngit]$ ll total 0 [dong@localhost learngit]$
[dong@localhost ~]$ git config –global user.name “zhd0305”
git clone git@github.com:zhd0305/hello-world.git
[dong@localhost learngit]$ ll total 0
[dong@localhost learngit]$ git clone git@github.com:zhd0305/hello-world.git
Cloning into 'hello-world'...
The authenticity of host 'github.com (192.30.253.112)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.253.112' (RSA) to the list of known hosts.
remote: Counting objects: 60, done.
remote: Total 60 (delta 0), reused 0 (delta 0), pack-reused 60
Receiving objects: 100% (60/60), 15.74 KiB | 5.00 KiB/s, done.
Resolving deltas: 100% (22/22), done.
[dong@localhost learngit]$ ll
total 4
drwxrwxr-x. 4 dong dong 4096 Feb 5 11:23 hello-world
[dong@localhost learngit]$