1.初始化工程
1
2
3
|
#mkdir git-project #cd git-project #git init --bare |
2.clone和提交代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#git clone ***克隆git***
#cd RSA #ll total 4 -rw-r--r-- 1 root root 3 Dec 18 15:43 README.md #git add test.txt #git commit -am "add test.txt" ***提交到仓库,并添加注释信息*** [master d2d81f3] add test .txt
3 files changed, 0 insertions(+), 0 deletions(-)
delete mode 100644 test2.txt
delete mode 100644 test3.txt
delete mode 100644 "\346\226\260\345\273\272 \345\245\275\345\216\213 ZIP \345\216\213\347\274\251\346\226\207\344\273\266.zip"
$git push #push到服务器
$git pull #更新
remote: Counting objects: 2, done .
remote: Compressing objects: 100% (2 /2 ), done .
remote: Total 2 (delta 1), reused 0 (delta 0) Unpacking objects: 100% (2 /2 ), done .
From http: //10 .240.210.40 /git/jyops/RSA
af57d29..f4d3bd6 master -> origin /master
Merge made by the 'recursive' strategy.
temp.txt | 0
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 temp.txt
$git log | more #查看log日志
commit adeedf2aa48ea72d210fbc91a1f664319d0aaadb Merge: d2d81f3 f4d3bd6 Author: test < test @jiayuan.com>
Date: Fri Dec 18 19:38:00 2015 +0800 Merge branch 'master' of http: //10 .240.210.40 /git/jyops/RSA
commit d2d81f34b6a3f86ad5699e614d6f7625f5011320 Author: test < test @jiayuan.com>
Date: Fri Dec 18 19:09:58 2015 +0800 add test .txt
commit f4d3bd6d5ae65337490d9a0d7e243c8d90ffbe73 Author: test < test @jiayuan.com>
Date: Fri Dec 18 16:08:29 2015 +0800 |
3.git clone时携带用户名密码
1
|
https: //username :password@github.com /username/repository .git
|
本文转自 xoyabc 51CTO博客,原文链接:http://blog.51cto.com/xoyabc/1726194,如需转载请自行联系原作者