使用git服务器的工程师都需要生成一个ssh的公钥
The authenticity of host 'localhost (::1)' can't be established.
RSA key fingerprint is eb:e3:e2:36:84:64:23:f2:b8:7b:a0:4c:ef:d4:9e:7d.
Are you sure you want to continue connecting (yes/no)?
Host key verification failed.
执行一下:$ssh localhost -o StrictHostKeyChecking=no
(用ssh登录一下就好使,就不会弹出The authenticity of host 'localhost (::1)' can't be established.的错误了。)
然后再退出ssh登录。
然后:
a@ubuntu:~/linux-2.6$ git push origin master
Counting objects: 56913, done.
Compressing objects: 100% (56081/56081), done.
Writing objects: 100% (56913/56913), 150.96 MiB | 4.08 MiB/s, done.
Total 56913 (delta 4433), reused 0 (delta 0)
To git@localhost:/home/git/work/project.git
* [new branch] master -> master
a@ubuntu:~/linux-2.6$ ls
就好了。
小组内开发者b下载代码时:
b@ubuntu:~$ git clone git@localhost:/home/git/work/project.git
Initialized empty Git repository in /home/b/project/.git/
The authenticity of host 'localhost (::1)' can't be established.
RSA key fingerprint is eb:e3:e2:36:84:64:23:f2:b8:7b:a0:4c:ef:d4:9e:7d.
Are you sure you want to continue connecting (yes/no)?
Host key verification failed.
fatal: The remote end hung up unexpectedly
b@ubuntu:~$
同样执行一下:
b@ubuntu:~$ ssh localhost -o StrictHostKeyChecking=no
b@ubuntu:~$ git clone git@localhost:/home/git/work/project.git
Initialized empty Git repository in /home/b/project/.git/
git@localhost's password:
remote: Counting objects: 56913, done.
remote: Compressing objects: 100% (51648/51648), done.
remote: Total 56913 (delta 4433), reused 56913 (delta 4433)
Receiving objects: 100% (56913/56913), 150.96 MiB | 13.48 MiB/s, done.
Resolving deltas: 100% (4433/4433), done.
Checking out files: 100% (53646/53646), done.
b@ubuntu:~$ ls
examples.desktop project
b@ubuntu:~$ ls
examples.desktop project
b@ubuntu:~$
b@ubuntu:~$
b@ubuntu:~$ cd project/
b@ubuntu:~/project$ ls
arch crypto include kernel net security
block Documentation init lib README sound
certs drivers ipc MAINTAINERS REPORTING-BUGS tools
COPYING firmware Kbuild Makefile samples usr
CREDITS fs Kconfig mm scripts virt
分析 ssh localhost -o StrictHostKeyChecking=no可能不会检查公钥的正确性就让登录了。