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

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

  • 相关阅读:
    Linux中逻辑卷的快照与还原
    Linux 中磁盘阵列RAID10损坏以及修复
    Linux 中磁盘阵列RAID10配置
    Linux 中磁盘容量配额
    Centos7VMware虚拟机最小化安装后,安装Tenda U12 USB无线网卡驱动
    安装vmware-tools遇the path "" is not valid path to the gcc binary和the path "" is not a valid path to the 3.10.0-327.e17.x86_64 kernel headers问题解决
    /etc/postfix下 main.cf 配置文件详解
    Linux安装配置vsftp搭建FTP的详细配置
    Linux中ftp的常用命令
    javascript深入理解js闭包
  • 原文地址:https://www.cnblogs.com/zccblog/p/7613612.html
Copyright © 2011-2022 走看看