Github使用方法

2012-04-18 | 夜光 | IT记录| 发表评论

Github使用方法:

教程地址:
http://help.github.com/set-up-git-redirect/
http://help.github.com/create-a-repo/
http://help.github.com/fork-a-repo/
http://help.github.com/be-social/
http://learn.github.com/p/tagging.html
http://gitref.org/branching/
http://blog.163.com/fenglang_2006/blog/static/13366231820111171542658/

一、Windows下软件安装及设置:

(1)到这里下载软件,安装时全部默认设置http://code.google.com/p/msysgit/downloads/list
(2)运行桌面上产生的“Git Bash”,会出现命令框,进行下面的设置
ssh-keygen -t rsa -C “your_email@youremail.com” 会提示SSH Public Keys的存放位置,默认就好,按一下“Enter”
接下来会出现两次输入密码,可设空密码,即按两下“Enter”
出现“The key fingerprint is:”字样说明Key产生了,在C:\Documents and Settings\Harry Dong\.ssh\下的id_rsa.pub文件
登录Github,依次点击 Account Settings–SSH Public Keys–Add another public key 其中的“Title”随便填,“Key”填写刚刚产生的id_rsa.pub文件中的全部内容
ssh -T git@github.com 测试连接
出现“Are you sure you want to continue connecting(yes/no)?”输入yes按一下“Enter”
接下来两行是设置个人信息(会保存在C:\Documents and Settings\Harry Dong\.gitconfig文件)

git config --global user.name "username"
git config --global user.email "your_email@youremail.com"

二、创建项目及上传:

登录Github官网首页,点击“Create A Repository”创建一个项目,点击“New Repository”,然后“Project Name”输入“wp-code-highlight”(会作为url全用小写),“Description”填写描述,“Homepage URL”填写发布地址
在D盘创建一个Github文件夹,在里面再创建一个wp-code-highlight文件夹,并将项目文件放进去,在“wp-code-highlight”文件夹上右击“Git bash”出现命令框

git init  输入这个
git add . 添加所有文件(只是在本地准备好,注意那个“.”表示所有文件)
git commit -m 'version 1.2.3'  引号中是说明信息
git remote add origin git@github.com:boliquan/wp-code-highlight.git
git push origin master  上传步骤到此完成

三、修改本地文件及上传

修改好本地文件后,在“wp-code-highlight”文件夹上右击“Git bash”出现命令框

如果添加了内容则要先 git add .
git commit -a -m 'version 1.2.3'  修改(本地)
git push origin master  修改(服务器),去Github网上可以发现已经修改了

四、创建一个tag:

在“wp-code-highlight”文件夹上右击“Git bash”出现命令框

git tag -a 1.2.3 -m 'version 1.2.3'  引号中是说明信息
git push --tags  就可以在Github网上看到创建的tag了

五、删除某个tag

在“wp-code-highlight”文件夹上右击“Git bash”出现命令框

git tag -d 1.2.3  删除这个tag(本地)
git push origin :refs/tags/1.2.3   删除这个tag(服务器),这时可以发现Github网上的那个tag不见了

六、从服务器下载项目

在“Github”文件夹上右击“Git bash”出现命令框

git clone git@github.com:boliquan/wp-code-highlight.git  会下载到一个以“wp-code-highlight”命名的文件夹及源码
本文标签:
本文链接: http://boliquan.com/github-method-of-use/
版权所有: 玻璃泉, 转载请注明本文出处。

发表评论

您的昵称 *

您的邮箱 *

您的网站

icon_wink.gif icon_neutral.gif icon_mad.gif icon_twisted.gif icon_smile.gif icon_eek.gif icon_sad.gif icon_rolleyes.gif icon_razz.gif icon_redface.gif icon_surprised.gif icon_mrgreen.gif icon_lol.gif icon_idea.gif icon_biggrin.gif icon_evil.gif icon_cry.gif icon_cool.gif icon_arrow.gif icon_confused.gif icon_question.gif icon_exclaim.gif

Protected by WP Anti Spam