zoukankan      html  css  js  c++  java
  • git 上传项目到仓库

    git 上传项目到仓库

     

    第一步:建立仓库!

    1、create new repository! 创建时最好选择 init (Initialize this repository with a README  --> 自动生成README.md 文件) 2、如果未选择 init (没有README.md 文件,会报错)

    可在git 执行一下命令创建

    创建 -- ① git init 
    ② touch README.md 
    上传 -- ③ git add README.md
    ④ git commit -m 'first_commit'
    ⑤ git remote add origin '项目地址'
    ⑥ git push origin master

    第二步:克隆仓库!

    1、确认公钥 -- 保持和远程服务器建立连接 ① ssh -T git@github.com 正确提示 -> 【Warning: Permanently added 'github.com,207.97.227.239' (RSA) to the list of known hosts.
      Hi findingsea! You've successfully authenticated, but GitHub does not provide shell access.】 2、clone 项目地址:https://github.com/findingsea/myRepoForBlog.git ② git clone https://github.com/findingsea/myRepoForBlog.git 成功后提示  ->   Cloning into 'myRepoForBlog'...   Warning: Permanently added 'github.com,207.97.227.239' (RSA) to the list of known hosts.   remote: Counting objects: 3, done.   remote: Total 3 (delta 0), reused 0 (delta 0)   Receiving objects: 100% (3/3), done.

    第三步:上传README.md文件(已初始化的可跳过此步骤)

    1、创建 README.md 文件 ① git init ② touch README.md ③ git add README.md ④ git commit -m 'first_commit' ⑤ git remote add origin '项目地址' ⑥ git push origin master

    第四步: push 文件

    1、创建完README.md后,执行此步骤

    ① git add .    ② git commit -m 'first_commit'   ③ git remote add origin https://github.com/findingsea/myRepoForBlog.git   ④ git push origin master

    2、如果执行git remote add origin https://github.com/findingsea/myRepoForBlog.git,出现错误:

    fatal: remote origin already exists

    则执行以下语句:

    git remote rm origin

    3、再往后执行git remote add origin https://github.com/findingsea/myRepoForBlog.git 即可。   在执行git push origin master时,报错:

    error:failed to push som refs to.......

    4、则执行以下语句:

    git pull origin master

    5、补充 --

    第四步最为重要!!!可重复执行
    ① git add . ② git commit -m '注释说明' ③ git remote add origin '项目地址' ④ git push origin master

    *******************************************************

  • 相关阅读:
    ESP32环境搭建(arduino)
    uPyCraftIDE的介绍以及使用
    ESP32项目汇总
    MicroPython固件烧写
    Server 架构
    base家族在线解密工具
    第1年2月24日 iOS相机旋转问题 为什么UIimage.ciimage值为空
    第1年2月23日 du -sh * | sort -n 统计当前文件夹(目录)大小,并按文件大小排序
    第1年2月14日 mac 运行java
    第1年2月10日 检查iOS app证书过期时间信息
  • 原文地址:https://www.cnblogs.com/zccblog/p/7613612.html
Copyright © 2011-2022 走看看