笔记 - Git使用

关于Git的简单使用,只记录了一些常用的指令,全面的用法在百度上面很多

 

常用指令:

Clone项目

git clone http://git.oschina.net/xxxxxx/xxxxxx.git

#更新本地代码

git pull

 

#Add

git add .

#commit

git commit -am ""

#提交master分支

git push origin master

#进入指定的本地目录

cd /d/apps/WorkSpaces/ADT/rexdemo

 

#避免每次都输入username and password:

http://www.cnblogs.com/ballwql/p/3462104.html

#使用方法一即可(亲测)

 

1.1 创建文件存储GIT用户名和密码, Ubuntu下也可用

在%HOME%目录中,一般为C:\users\Administrator,也可以是你自己创建的系统用户名目录,反正都在C:\users\中。文件名为.git-credentials,由于在Window中不允许直接创建以"."开头的文件,所以需要借助git bash进行,打开git bash客户端,进行%HOME%目录,然后用touch创建文件 .git-credentials, 用vim编辑此文件,输入内容格式:

touch .git-credentials

vim .git-credentials

https://{username}:{password}@github.com

1.2 添加Git Config 内容

进入git bash终端, 输入如下命令:

git config --global credential.helper store

上面操作完成后,尝试从Git上面Clone一份代码,这时还需要输入一次,Clone完成后,打开 .git-credentials,会发现多了行数据,就是用户名和数据,是使用明文保存的

posted @ 2015-07-12 08:13  RexZxb  阅读(97)  评论(0)    收藏  举报