【问题标题】:Setting up git-core, gitolite and gitweb in ubuntu 12.04 and adding a windows machine as git client isn't working在 ubuntu 12.04 中设置 git-core、gitolite 和 gitweb 并在 git 客户端不工作时添加 windows 机器
【发布时间】:2017-02-14 21:19:11
【问题描述】:

我正在使用此链接在 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 并添加到/home/<username>/.ssh/ 文件夹中。
然后我在windowscmd中运行scp命令:

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?

【问题讨论】:

  • 谁投票决定结束这个问题?

标签: windows git ubuntu github ssh


【解决方案1】:

然后我将pub key复制到ubuntu并添加到/home/<username>/.ssh/文件夹

您实际上需要将其添加到 /home/git/.ssh/authorized_keyswith 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

您必须能够以git 的身份打开ssh 会话,然后才能继续操作。

【讨论】:

  • 拥有正确的权限?你想让我做一个chmod 777
  • .ssh 文件夹中没有 authorized_keys 文件。于是我直接跑了cat ~/id_rsa.pub >> ~/.ssh/authorized_keys,修改了权限,去掉了id_rsa.pub。然后我转到 Windows 并在文件路径周围用双引号执行 scp 命令。我得到了这个输出:ssh: C: no address associated with name
  • 对,语法错误。让我再检查一下(现在在我的手机上)
  • 好的...我尝试不使用双引号,scp 要求输入密码。我很惊讶,因为我在生成密钥时给出了密码。尽管如此,我给了 ubuntu 的密码,但它拒绝连接。为什么?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-08-02
  • 2011-10-28
  • 1970-01-01
  • 2012-05-02
  • 1970-01-01
  • 2013-10-01
  • 1970-01-01
相关资源
最近更新 更多