zoukankan      html  css  js  c++  java
  • git clone的低级错误

    犯了一个低级错误:

    server ip: 192.168.40.41

    有一个git账户

    所有的git仓库都在/home/git仓库下

    比如/home/git/u-boot-2018.07-fmxx.git

    我用了以下命令:

    git clone 192.168.40.41:/home/git/u-boot-2018.07-fmxx.git

    改过一些东西后,发现git push不上去

    而且git clone时候输入的是我的账户密码,并不是git的密码

    然后让同事帮忙看了一下:

    git remote -v

    origin  192.168.40.41:/home/git/u-boot-2018.07-fmxx.git (fetch)
    origin  192.168.40.41:/home/git/u-boot-2018.07-fmxx.git (push)


    git remote -h

    可以显示命令的用法。

    git remote set-url [--push] <name> <newurl> [<oldurl>]

    git remote set-url origin git@192.168.40.41:/home/git/u-boot-2018.07-fmxx.git/

    就是将<name>为origin的的新url设置为git@192.168.40.41:/home/git/u-boot-2018.07-fmxx.git/

    所以git@192.168.40.41:/home/git/u-boot-2018.07-fmxx.git/的意思是:

    git表示git用户,意思就是git用户艾特在192.168.40.41上,目录/home/git/u-boot-2018.07-fmxx.git/下的仓库。

    这时候push pull 都是git的密码了,能成功。

    我又新建了一个仓库,/home/zhangyi/tmp

    git init --bare #建立了一个裸仓库

    git clone 192.168.40.41:/home/zhangyi/tmp

    #这样可以push 因为是同一个用户吧,后来用其他用户git clone 不加zhangyi@,出现了不能push的错误

    error: remote unpack failed: unable to create temporary object directory
    To 192.168.40.41:/home/zhangyi/tmp
     ! [remote rejected] master -> master (unpacker error)
    error: failed to push some refs to '192.168.40.41:/home/zhangyi/tmp'

    git remote -v

    origin  192.168.40.41:/home/zhangyi/tmp (fetch)
    origin  192.168.40.41:/home/zhangyi/tmp (push)

    在其他用户下

    git clone zhangyi@192.168.40.41:/home/zhangyi/tmp

    需要输入zhangyi的密码,可以正常push pull。

  • 相关阅读:
    MongoDB入门下
    MongoDB简介
    MongoDB 查询上
    MongoDB 创建,更新,删除文档 下
    MongoDB 创建,更新,删除文档 上
    SqlServer 对 数据类型 text 的操作
    Asp.Net编码
    MongoDB 查询下
    (基于Java)编写编译器和解释器第3A章:基于Antlr构造词法分析器(连载)
    (基于Java)编写编译器和解释器第2章:框架I:编译器和解释器第三部分(连载)
  • 原文地址:https://www.cnblogs.com/idyllcheung/p/11396186.html
Copyright © 2011-2022 走看看