Quantcast
Channel: 碳基体
Viewing all articles
Browse latest Browse all 75

github最基本的使用

$
0
0
记录最简单的github源码托管操作,其实,作为IT人员,现在才提起github,已经过时到不行了。


最早接触github,完全是因为要“借用”大牛们编写的工具。于是最先学会了

git clone 地址 来下载源码

git pull 与更新源码


题外话,由于强迫症似的到处收集工具,除了git以外,还接触了Mercuria (hg),Subversion(svn)这些版本管理工具,但最最流行的还是git,其中github起到了巨大的推广作用(看看git的出书,it杂志上的git专栏)。

好了,回到正题。

首先,我们需要在本地机器上安装git

一、git安装
1. 本地安装git
windows下

下载

 http://msysgit.github.io/

Debian/Ubuntu下

apt-get install git


Mac上



2. git命令自动补全

git clone https://github.com/git/git.git

cp git/contrib/completion/git-completion.bash ~/.git-completion.bash
vim ~/.bashrc
添加 
source  ~/.git-completion.bash

source .bashrc 
更多学习参考:http://git.oschina.net/progit/index.html


二、github注册帐号及基本的操作(以上传README文件为例)
1. github 注册帐号
https://github.com/

2.git全局配置

git config --global user.name "xxx" #你在github上的帐号 

git config --global user.email "xxx@gmail.com"#你在github上的邮箱地址

3.在github上创建一个repository
https://github.com/
点击create repositories, 为repository取个名字,以perl_tools为例

4.在本地创建源码文件夹
mkdir perl_tools
cd perl_tools/
git init

5.提交文件,以提交README文件为例 


vim README #在工作目录下修改文件,此时文件的状态是已修改状态


随便写点啥


git add README #将修改文件放到暂存目录,此时文件的状态是已暂存状态

git commit -m 'create README file' #将放置在暂存目录中的文件提交到本地仓库此时文件的状态是已提交状态

git remote add origin https://github.com/[github username][github_repository_name].git #添加远程仓库,例子中将远程仓库取名为origin,这个操作只需要一次,后续修改上传文件都不要执行

git push origin master #将本地仓库master的数据推送到远程仓库origin

Username for 'https://github.com': xxx
Password for 'https://xxx@github.com':
就ok了,上传其他文件步骤相同。

三、我的github
https://github.com/tanjiti/perl_tools
尝试上传了几个最近写的小工具(申明我是编程菜鸟),像搭积木,蛮好玩的

isRealSpider.pl 判断指定ip是不是google/baidu/yahoo/bing/msn爬虫
github最基本的使用 - 碳基体 - 碳基体
 
getIPinfoOnline.pl 查询指定IP的基本信息,读取了以下在线IP接口
    1  ipinfo.io
    2  ip-api.com
    3  ip-taobao.com 淘宝IP
    4  www.cz88.net 纯真IP
    5  ip.chinaz.com 站长之家IP
github最基本的使用 - 碳基体 - 碳基体
 
getIPinfoOffline.pl 从本地离线IP数据库查询指定IP/域名的基本信息,IP数据库来自maxmind.com
github最基本的使用 - 碳基体 - 碳基体
 
whichCDNUser.pl 判断指定host是否使用了CDN服务(能识别cloudflare,incapsula,360网站卫士, 加速乐,云加速,安全宝)
github最基本的使用 - 碳基体 - 碳基体
 
readTitle.pl 读取指定域名的title,主要加入了中文解码
github最基本的使用 - 碳基体 - 碳基体

 


Viewing all articles
Browse latest Browse all 75

Trending Articles