• 将本地项目添加到gitee仓库的操作流程:


    将本地项目添加到gitee仓库的操作流程:

    1. 码云上创建一个项目,例如 fighting

    2. 本地创建一个文件夹D:/Java/fighting,然后鼠标右击选择git bash here

    3. 使用 git init 命令,初始化一个git本地仓库(项目),会在本地创建一个 .git 的文件夹

    4. 使用git remote add origin fighting的git克隆地址 //添加远程仓库 // 示例:git remote add origin https://gitee.com/xxxx/fighting.git// 示例:git remote add origin https://gitee.com/cheng-huanlong/chl.git

    5. 使用 git pull origin master 命令,将码云上的仓库pull到本地

    6. 将要上传的文件,添加到刚刚创建的文件夹fighting里

    7. 使用git add . 或者 git add + 文件名 (将文件保存到缓存区)

    8. 使用git commit -m ‘描述新添加的文件内容’ (就是提交代码的注释) (文件保存到本地仓库)

    9. 使用git push origin master,将本地仓库推送到远程仓库

    完成!

    git push遇到错误: [rejected]master -> master (non-fast-forward)的解决方法

    执行git push只之后报如下错误:

    Username for 'https://gitee.com': **@**.com
    fatal: unable to get credential storage lock: File exists
    To https://gitee.com/**/**.git
    ! [rejected]       master -> master (non-fast-forward)
    error: failed to push some refs to 'https://gitee.com/**/**.git'
    hint: Updates were rejected because the tip of your current branch is behind
    hint: its remote counterpart. Integrate the remote changes (e.g.
    hint: 'git pull ...') before pushing again.
    hint: See the 'Note about fast-forwards' in 'git push --help' for details.

    解决方法:

    git pull origin master --allow-unrelated-histories //把远程仓库和本地同步,消除差异

    git add .

    git commit -m '***'

    git push origin master
  • 相关阅读:
    SpringCloud Alibaba微服务实战十
    万字长文!分布式锁的实现全都在这里了
    python编程中的小技巧(持续更新)
    工作十年的数据分析师被炒,没有方向,你根本躲不过中年危机
    github入门操作快速上手
    167. 两数之和 II
    167. 两数之和 II
    167. 两数之和 II
    怎么使用Fiddler进行抓包
    怎么使用Fiddler进行抓包
  • 原文地址:https://www.cnblogs.com/pettyqi/p/13881712.html
Copyright © 2020-2023  润新知