Github Manual

github文档库: https://help.github.com/articles/


(一) 安装配置git

1. 安装git

2. username:显示在commit历史中,标识提交者

$ git config --global user.name "Your Name Here"
# Sets the default name for git to use when you commit

3. email:保存在commit中,github通过该email关联到github账户

$ git config --global user.email "your_email@example.com"
# Sets the default email for git to use when you commit


4. 使用password caching,仅对git version > 1.7.10有效

在一定时间内,不用每次输入password

默认缓存15分钟

$ git config --global credential.helper cache
# Set git to use the credential memory cache

改变缓存时间,单位为秒

$ git config --global credential.helper 'cache --timeout=3600'
# Set the cache to timeout after 1 hour (setting is in seconds)

(二) 创建repository

1. github上点击“new repository”

2. 在本地添加文件,以README为例

$ mkdir ~/Hello-World
# Creates a directory for your project called "Hello-World" in your user directory

$ cd ~/Hello-World
# Changes the current working directory to your newly created directory

$ git init
# 初始化,Sets up the necessary Git files
# Initialized empty Git repository in /Users/you/Hello-World/.git/

$ touch README
# 创建README,向其添加内容


3. commit 所做改动

$ git add README
# Stages your README file, adding it to the list of files to be committed

$ git commit -m 'first commit'
# -m内容进入commit历史,可用git log查看

4. 推送到远端git库

$ git remote add origin https://github.com/username/Hello-World.git
# “username”为github用户名
# 禁止https访问时,可用http代替

$ git push origin master
# Sends your commits in the "master" branch to GitHub

5. 用git clone验证推送是否成功

$ mkdir ~/test_push
$ cd ~/test_push
$ git clone https://github.com/username/Hello-World.git




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值