git 提交远程

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

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

C:\Users\chendd>cd E:\web

C:\Users\chendd>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:\web\findbug-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:\web\findbug-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:\web\findbug-v0.1>git config --global user.email "mail4chedd@qq.com"

E:\web\findbug-v0.1>git config --global user.name "chendd"

E:\web\findbug-v0.1>git commit -a -m "test"
[master 32a7c94] test
 1 file changed, 1 insertion(+)

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

E:\web\findbug-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:\web\findbug-v0.1>cd ..

E:\web>mkdir beatplane

E:\web>cd beatplane

E:\web\beatplane>git init
Initialized empty Git repository in E:/web/beatplane/.git/

E:\web\beatplane>touch README.md

E:\web\beatplane>git add README.md

E:\web\beatplane>git add .

E:\web\beatplane>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 "\346\226\260\345\273\272\346\226\207\346\234\254\346\226\20
7\346\241\243 (2).txt"
 create mode 100644 "\346\226\260\345\273\272\346\226\207\346\234\254\346\226\20
7\346\241\243.txt"

E:\web\beatplane>git remote add origin https://github.com/chendd/BeatPlane.git

E:\web\beatplane>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客户端 安装 和使用

posted @ 2014-08-10 13:23  aiguozhe1991  阅读(617)  评论(0编辑  收藏  举报