我正在使用此链接在 ubuntu 12.04 中安装 git-core、gitolite 和 gitweb:
https://ao2.it/wiki/How_to_setup_a_GIT_server_with_gitolite_and_gitweb
我安装了git-core通过使用此命令:

sudo apt-get install git-core   

然后我添加了一个新用户 git通过使用此命令:
sudo adduser \ 
    --system \ 
    --shell /bin/bash \ 
    --gecos 'git SCM user' \ 
    --group \ 
    --disabled-password \ 
    --home /home/git \ 
    git   

然后我在 /home/git 中添加了存储库
sudo -u git mkdir /home/git/repositories   

然后我搬到windows机器上,生成 pubppk使用此命令键:
ssh-keygen -t rsa   

然后我复制了 pub ubuntu 的 key 并将其添加到 /home/<username>/.ssh/文件夹。
然后我跑了 scp Windows 中的命令 cmd :
scp C:/Users/Ajay Kulkarni-enEXL/.ssh/id_rsa.pub 192.168.1.140:git.pub   
git是我之前创建的 Ubuntu 中的新用户名。
该命令的输出是:
You can't hack this system from external connectors like putty telnet etc.!! 
 
Good luck with hacking this system cheers :) 
Ajay Kulkarni-enEXL@192.168.1.140's password: 
Permission denied, please try again. 
Ajay Kulkarni-enEXL@192.168.1.140's password: 
Permission denied, please try again. 
Ajay Kulkarni-enEXL@192.168.1.140's password: 
Permission denied (publickey,password). 
lost connection   

我得到了这个堆栈转储:
Exception: STATUS_ACCESS_VIOLATION at eip=61050C17 
eax=00000000 ebx=616D16C8 ecx=0000000B edx=00000000 esi=0028E870 edi=002F0028 
ebp=0028E708 esp=0028E6E0 program=C:\Program Files (x86)\OpenSSH\bin\ssh.exe, pid 6924, thread main 
cs=0023 ds=002B es=002B fs=0053 gs=002B ss=002B 
Stack trace: 
Frame     Function  Args 
0028E708  61050C17  (616D16C8, 00000001, 0028E870, 00000001) 
0028E768  610A341F  (00000004, 00000001, 0028E870, 00000020) 
0028E8B8  6108DF2F  (0028ED10, 0028E8D0, 00000400, 00000002) 
0028ECE8  00428777  (0028ED10, 00000000, 004104F5, 100E8C78) 
0028EDB8  0041058A  (0028EE20, 0000004F, 00000000, 0028EE34) 
0028EDD8  0040FD53  (0028EE20, 100EF838, 0028EE20, 0041B469) 
0028EE08  0041AA08  (00000000, 0028EE34, 0028EE20, 0040F7A4) 
0028EE68  0040FBD8  (100E8C60, 100E8C78, 100E8C48, 004391B0) 
0028F038  004023A0  (00000001, 616D2744, 100E00A8, 0028F090) 
0028F078  61005F54  (0028F090, 00570056, 00590058, 007B005A) 
0028FF58  6100616B  (00000000, 00000000, 00000000, 00000000) 
End of stack trace   
scp无法连接到 ubuntu 实例。如何制作 scp连接到ubuntu?

请您参考如下方法:

Then I copied pub key to ubuntu and added it to /home/<username>/.ssh/ folder



您实际上需要将其添加到 /home/git/.ssh/authorized_keys ( with the right permission , 如 seen here
server$ mkdir ~/.ssh 
server$ chmod 700 ~/.ssh 
server$ cat ~/id_rsa.pub >> ~/.ssh/authorized_keys 
server$ chmod 600 ~/.ssh/authorized_keys 
server$ rm ~/id_rsa.pub 

)。

测试您的 ssh 连接
ssh -Tv git@192.168.1.140 

您必须能够打开 ssh session 为 git , 在继续之前。


评论关闭
IT序号网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!