Git是最近非常火的一个版本管理工具(VCS),GitHub,OSChina,CSDN均支持Git。
GitHub经常被墙,实验了一下Git @ OSC (OSChina)。
从http://git-scm.com/downloads下载Git最新版本,
安装过程比较简单,不做介绍。
首先配置用户名,
1: git config --global user.name "your name"
然后配置邮件地址,
1: git config --global user.email "your email address"
使用SSH Key可以电脑本地与Git @ OSC 之间建立安全连接。
使用如下那个生成SSH Key
1: ssh-keygen -t rsa -C git@git.oschina.net
打开SSH Key文件,并添加到 Git @ OSC http://git.oschina.net/keys
1: cat ~/.ssh/id_rsa.pub
在Git bash中输入如下命令,实验SSH Key是否添加成功。
1: ssh -T git@git.oschina.net
返回
1: Welcome to Git@OSC, yourname!
初始化一个版本仓库
1: git init
加入代码文件后,执行如下命令
1: git add .
提交修改
1: git commit -m "your message"
在Git @ OSC 创建版本库,并将其url添加为远程版本库
1: git remote add origin "url"
查看已添加远程版本库
1: git remote -v
将本地修改推送到远程版本库
1: git push origin master
我们创建的工程已经提交到Git @ OSC ,去网站看看吧
原文:http://www.cnblogs.com/wormsun/p/3578834.html