Git使用

作者: 冬风十里Y | 来源:发表于2018-08-18 21:32 被阅读2次

    配置git过程主要参考:https://blog.csdn.net/szj_huhu/article/details/77541345

    申请账号略过。从配置账号说起。
    文章中第一节“ubuntu下Git和GitHub环境的搭建“步骤非常明晰,可以跟着一步步来。
    包括查看配置信息:
    git config user.name
    git config user.email

    第二节是从本地上传到github

    第一步: 进入要所要上传文件的目录输入命令 git init

    第二步: 创建一个本地仓库origin,使用命令 git remote add origin git@github.com:yourName/yourRepo.git youname是你的GitHub的用户名,yourRepo是你要上传到GitHub的仓库,这是你再GitHub上添加的仓库。

    第三步: 比如你要添加一个文件xxx到本地仓库,使用命令 git add xxx,可以使用git add .自动判断添加哪些文件

    第四步 :然后把这个添加提交到本地的仓库,使用命令 git commit -m ‘this is for test’
    最后把本地仓库origin提交到远程的GitHub仓库,使用命令 git push origin master

    中间遇到一步错误:
    fatal: remote origin already exists.
    解决方法如下:
    https://blog.csdn.net/dengjianqiang2011/article/details/9260435

    在最后一步git push origin master时候又遇到

    ymd@ymd-ustc:~/ustclog$ git push origin master
    To git@github.com:heres-y/CrooooseNet
     ! [rejected]        master -> master (fetch first)
    error: failed to push some refs to 'git@github.com:heres-y/CrooooseNet'
    hint: Updates were rejected because the remote contains work that you do
    hint: not have locally. This is usually caused by another repository pushing
    hint: to the same ref. You may want to first integrate the remote changes
    hint: (e.g., 'git pull ...') before pushing again.
    hint: See the 'Note about fast-forwards' in 'git push --help' for details.
    

    解决方法如下:
    https://blog.csdn.net/winnershili/article/details/78888548

    发现一张很有用的图
    from : https://blog.csdn.net/Hallo_ween/article/details/52456327

    20161003163617053.jpeg

    修改commit 的注释。
    https://blog.csdn.net/sodaslay/article/details/72948722

    git clone 一直clone 不下来,报错:

    fatal: The remote end hung up unexpectedly
    fatal: early EOF
    fatal: index-pack failed
    

    解决办法,增大缓存:
    git config --global http.postBuffer 524288000

    相关文章

      网友评论

          本文标题:Git使用

          本文链接:https://www.haomeiwen.com/subject/lvqqiftx.html