Bad configuration options

自己创建git服务器,也不是第一次。但是很少,结果又出错了。

 

.ssh/config: line 2: Bad configuration option: host:106.xx.xx.35
.ssh/config: terminating, 1 bad configuration options
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

反反复复回头,特别是注意权限设置需要修改?

 

git:x:502:502::/home/git:/bin/bash

git:x:502:502::/home/git:/usr/local/git/bin/git-shell

 

不能够一开始就改还是改成1000而不是502?因为一改就不能够加入公钥?但是root用户也可以吧?所以可能不需要在意。

 

https://www.cnblogs.com/mverting/p/10206532.html

 

 

 

四. 配置git

  1. Git服务器打开RSA认证
    vi /etc/ssh/sshd_config #以下项前面的#去掉
    1.RSAAuthentication yes
    2.PubkeyAuthentication yes
    3.AuthorizedKeysFile .ssh/authorized_keys

  2. 禁止Shell登录
    vi /etc/passwd
    git:x:502:502::/home/git:/bin/bash 修改成下面的 git的路径要设置成自己的
    git:x:502:502::/home/git:/usr/local/git/bin/git-shell

  3. 创建git用户组和用户
    groupadd git
    useradd git -g git
    passwd git
    su - git #切换到刚创建的git用户

  4. 创建用户公钥文件
    cd /home/git/
    mkdir .ssh #新建文件夹
    chmod 700 .ssh
    touch .ssh/authorized_keys #新建文件
    chmod 600 .ssh/authorized_keys
    后续用户只需要向authorized_keys中添加自己的公钥

五. 创建仓库及使用
1. cd /home/git #在某个文件夹下创建
git init --bare test.git #创建一个空仓库 仓库名字叫 test

  2.  本地克隆仓库
        git clone git@your-ip:test.git

 

 

最后什么问题?

因为我的config格式出错了:

网友说不能够有缩进,我没有,但是……阿里云说注意字符格式代码……一看:host一栏多了个冒号,本来是空格。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值