• 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客户端 安装 和使用

  • 相关阅读:
    js 读取XML
    JavaScript DOM 交换节点笔记
    JDBC学习总结 -- JDBC 快速入门 教程
    SQL 语句易错点讲解
    JAVA 他人博客收藏 (To be continue)
    <<MYSQL必知必会>> 入坑指南
    OpenGL 纹理学习总结
    BZOJ 3456 NTT图的计数 容斥
    洛谷1002 容斥原理+dfs OR DP
    51nod1565 FFT
  • 原文地址:https://www.cnblogs.com/aiguozhe/p/3902729.html
Copyright © 2020-2023  润新知