zoukankan      html  css  js  c++  java
  • git 提交远程

    一、从远程克隆项目,修改后提交

    1、先切换要放项目的本地目录

    C:Userschendd>cd E:web
    
    C:Userschendd>e:

    2、根据服务器的git地址克隆到本地,并查看状态

    E:web>git clone https://github.com/findbugGroup/findbug-v0.1.git
    Cloning into 'findbug-v0.1'...
    remote: Counting objects: 1436, done.
    remote: Compressing objects: 100% (1313/1313), done.
    remote: Total 1436 (delta 476), reused 0 (delta 0)
    Receiving objects: 100% (1436/1436), 3.29 MiB | 190.00 KiB/s, done.
    Resolving deltas: 100% (490/490), done.
    Checking connectivity... done.
    
    E:web>git status
    fatal: Not a git repository (or any of the parent directories): .git
    
    E:web>cd findbug-v0.1
    
    E:webfindbug-v0.1>git status
    On branch master
    Your branch is up-to-date with 'origin/master'.
    
    Changes not staged for commit:
      (use "git add <file>..." to update what will be committed)
      (use "git checkout -- <file>..." to discard changes in working directory)
    
            modified:   README.md
    
    no changes added to commit (use "git add" and/or "git commit -a")

    3、修改下项目,提交到本地暂存(可能要输入用户名,密码。也可以提前配置)

    E:webfindbug-v0.1>git commit -a -m "test"
    
    *** Please tell me who you are.
    
    Run
    
      git config --global user.email "you@example.com"
      git config --global user.name "Your Name"
    
    to set your account's default identity.
    Omit --global to set the identity only in this repository.
    
    fatal: unable to auto-detect email address (got 'chendd@chendd-PC.(none)')
    
    E:webfindbug-v0.1>git config --global user.email "mail4chedd@qq.com"
    
    E:webfindbug-v0.1>git config --global user.name "chendd"
    
    E:webfindbug-v0.1>git commit -a -m "test"
    [master 32a7c94] test
     1 file changed, 1 insertion(+)

    4、提交到远程服务器上去

    E:webfindbug-v0.1>git push origin master
    Username for 'https://github.com': chendd
    Password for 'https://chendd@github.com':
    Counting objects: 5, done.
    Delta compression using up to 2 threads.
    Compressing objects: 100% (2/2), done.
    Writing objects: 100% (3/3), 284 bytes | 0 bytes/s, done.
    Total 3 (delta 1), reused 0 (delta 0)
    To https://github.com/findbugGroup/findbug-v0.1.git
       6fd4585..32a7c94  master -> master

    二、将本地项目提交到远程服务器

    1、先在远程网站上 new 个新的repository,复制git地址

         然后按照 网站上说的 终端上运行命令(这里我是后来再新建的,故git名加个2,区分)

    E:webfindbug-v0.1>cd ..
    
    E:web>mkdir beatplane
    
    E:web>cd beatplane
    
    E:webeatplane>git init
    Initialized empty Git repository in E:/web/beatplane/.git/
    
    E:webeatplane>touch README.md
    
    E:webeatplane>git add README.md
    
    E:webeatplane>git add .
    
    E:webeatplane>git commit -m "first commit"
    [master (root-commit) 7c19145] first commit
     3 files changed, 0 insertions(+), 0 deletions(-)
     create mode 100644 README.md
     create mode 100644 "34622626034527327234622620734623425434622620
    7346241243 (2).txt"
     create mode 100644 "34622626034527327234622620734623425434622620
    7346241243.txt"
    
    E:webeatplane>git remote add origin https://github.com/chendd/BeatPlane.git
    
    E:webeatplane>git push -u origin master
    Username for 'https://github.com': chendd
    Password for 'https://chendd@github.com':
    Counting objects: 3, done.
    Delta compression using up to 2 threads.
    Compressing objects: 100% (2/2), done.
    Writing objects: 100% (3/3), 239 bytes | 0 bytes/s, done.
    Total 3 (delta 0), reused 0 (delta 0)
    To https://github.com/chendd/BeatPlane.git
     * [new branch]      master -> master
    Branch master set up to track remote branch master from origin.

    提交刷新网页,大功告成

     附:git客户端 安装 和使用

  • 相关阅读:
    个人理解闭包
    个人理解回调
    在网站中设置一个分享到功能
    在lua中从一个字符串中移除空间源码
    成都实行积分落户
    unity3D客户端框架
    skynet对Windows环境支持的版本:Windows版skynet
    超期羁押
    资料
    媒体电话
  • 原文地址:https://www.cnblogs.com/aiguozhe/p/3902729.html
Copyright © 2011-2022 走看看