Git 初步

本文以ns-allinone-2.34为例,部署一个Git仓库

1、本地创建仓库

cd ns-allinone-2.34

# 初始化一个空的Git仓库

git init

# 添加跟踪文件

git add *

# 提交跟踪文件

git commit

2、设置忽略某些文件

vim .gitignore

# 不跟踪otcl文件
otcl

tclcl

# 不跟踪.o后缀的文件
*.o

*.a

# 不跟踪当前目录下的share目录
/share

/lib
/include
/bin
 

3、导出纯仓库

# 回到ns-allinone-2.34上级目录
cd ..

git clone --bare ns-allinone-2.34  ns-2.34.git
 

4、上传到服务器

扫描二维码关注公众号,回复: 1202989 查看本文章
scp -r ns-2.34.git  [email protected]:/git
 

5、从服务器获取项目仓库

git clone [email protected]:/git/ns-2.34.git
 

6、修改后推送到服务器仓库

git push origin master

7、进一步学习Git,可参考:

英文: http://progit.org/book/

中文: http://progit.org/book/zh/

猜你喜欢

转载自junyao29.iteye.com/blog/580045