美文网首页ios常用
Git第一次本地代码提交到远程仓库

Git第一次本地代码提交到远程仓库

作者: 最底层的技术渣 | 来源:发表于2019-12-19 10:23 被阅读0次

    前言

    要先确定前面是否已经存在仓库

    git remote -v
    

    如果存在,删除原有的仓库

    git remote rm origin
    

    1、git仓库初始化

    git init
    

    2、本地仓库连接到远程仓库

    git remote add origin [remote url]
    

    3、查看当前状态

    git status
    

    4、将代码添加到暂存区

    git add .
    
    此步骤报错warning: LF will be replaced by CRLF in 文件地址
    提交时转换为LF,检出时转换为CRLF
    git config --global core.autocrlf true
    

    5、将代码添加到仓库

    git commit -m 'first commit'
    

    6、将本地代码提交到远程仓库

    git push origin master
    

    如果报错,使用强制提交,git push -f origin master

    相关文章

      网友评论

        本文标题:Git第一次本地代码提交到远程仓库

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