zoukankan      html  css  js  c++  java
  • git教程 入门

    快速上传已有代码到github

    如何将最新代码上传到github,这里讲本地已有项目文件的情况(假如本地有一个helloworld的工程目录,目录中有很多项目文件。),步骤如下:

    前提:已安装git客户端(windows版),注册github账号。

    一、在github上点击new repositories

     新建一个项目,名字可以和本地名字一样,也可以不一样。这里我们创建一样的工程名:helloworld

    二、克隆项目到本地

    解决fatal: destination path '.' already exists and is not an empty directory.

    1. 从本地的git bash进入本地helloword目录。
    2. git clone --no-checkout [url] temp
    3. mv temp/.git .   #将 tmp 目录下的 .git 目录移到当前目录
    4. rmdir temp
    5. git reset --hard HEAD

    三、上传代码到github

    1.git bash进入本地helloword目录
    2.用git status查看文件上传情况
    3.用git add -A(把它们添加到暂存区)
    4.git commit -m "代码提交信息"(所有本地代码提交到了 HEAD)
    5.git push origin master(提交到远端仓库)

    备注:

    [url] 为github上项目的仓库地址
  • 相关阅读:
    绿色通道
    Banknotes
    旅行问题
    修剪草坪
    最大连续和
    动物园
    炮兵阵地
    涂抹果酱
    牧场的安排
    国王
  • 原文地址:https://www.cnblogs.com/firebata/p/5157705.html
Copyright © 2011-2022 走看看