1、
创建一个新的文件夹:
[[email protected] http]# mkdir activityTestLee
2、
进入该文件夹
[[email protected] http]# cd activityTestLee
3、
创建本地版本库:
[[email protected] activityTestLee]# git init
Initialized empty Git repository in /http/activityTestLee/.git/
4、
获取钩子:
[[email protected] activityTestLee]# scp -p -P 8849 [email protected]:hooks/commit-msg .git/hooks/
Enter passphrase for key ‘/root/.ssh/id_rsa‘:
commit-msg 100% 4365 4.3KB/s 00:00
5、
从远程版本库进行克隆(相当于建立了一个链表,并没有把代码从上面copy到本地):
[[email protected] activityTestLee]# git clone ssh://[email protected]:8849/activity
Initialized empty Git repository in /http/activityTestLee/activity/.git/
Enter passphrase for key ‘/root/.ssh/id_rsa‘:
remote: Counting objects: 3082, done
remote: Finding sources: 100% (3082/3082)
remote: Total 3082 (delta 1140), reused 3031 (delta 1140)
Receiving objects: 100% (3082/3082), 13.35 MiB | 670 KiB/s, done.
Resolving deltas: 100% (1140/1140), done.
6、
查看当前从远程版本库获取的东西
[[email protected] activityTestLee]# ls
activity
7、
进入到文件下面:
[[email protected] activityTestLee]# cd activity
8、
查看当前服务器和本地的所有分支:
[[email protected] activity]# git branch -al
* master
remotes/origin/HEAD -> origin/master
remotes/origin/develop
remotes/origin/huodong
remotes/origin/master
remotes/origin/production
9、
创建本地分支develop并从远程版本库分支上面获取内容(现在本地有代码了)
[[email protected] activity]# git checkout -b develop origin/develop
Branch develop set up to track remote branch develop from origin.
Switched to a new branch ‘develop‘
10、
查看有哪些文件:
[[email protected] activity]# ls
db deploy description.txt docs env_conf tools web
其实,可以从第五步开始,然后4-6-7-8-9-10