Github教程(0)
2015-12-14 22:43
260 查看
Git下载:https://git-for-windows.github.io/
我下载的版本是:Git-2.6.3-64-bit.exe
安装:略 默认选项点击"下一步"即可
安装完毕后
1.打开Git Bash
设置使用Git时候的名字和邮箱地址
2.注册Github账户:https://github.com/
3.设置SSH Key,在Git Bash中输入:
注: github register email这里写你在第二步注册Github账户的邮箱地址
然后按下回车,并设置认证密码(也可不设置)
回车,会得到两个文件:id_rsa(私有密钥),id_rsa.pub是公开密钥。
这两个文件默认在C:\Users\Username\.ssh目录下
4.添加公开密钥:
进入你的Github账户,在右上角选择SettingàSSH keysàAdd SSH key, 其中,Title输入一个名称,在Key处粘贴id_rsa.pub中的内容。
5.此时就可以用私人密钥和Github进行认证和通信,在Git Bash中输入:
提示:Are you sure you want to continue connecting (yes/no)?
输入:yes 回车
显示:Hi yourname! You've successfully authenticated, but Github does not provide shell access.
接下来,演示一个Github的HelloWorld示例:
进入Github账户,点击New repository
Repository name输入Hello
Description项输入一些对仓库的描述信息(选填)
Public/Private选项勾选Public
Initialize this repository with a README 选项选上
点击Create Repository即可创建一个Repository
点击进入Hello这个Repository,拷贝这个Repository的Web Address
将Hello这个Repository clone至本地,打开Git Bash,输入:
提示:repository's Web Address就是上一步骤拷贝的URL
Git Bash输入cd Hello,在Hello目录下增加一个文件,比如T.java
将T.java添加到暂存区,Git Bash中输入:
提交T.java, Git Bash中输入:
Push到Github上的仓库
进入Github账户中的Hello Repository,即可查看push进去T.java这个文件
查看提交日志:
我下载的版本是:Git-2.6.3-64-bit.exe
安装:略 默认选项点击"下一步"即可
安装完毕后
1.打开Git Bash
设置使用Git时候的名字和邮箱地址
$ git config --global user.name "yourname" $ git config --global user.email "youremail@email.com"
2.注册Github账户:https://github.com/
3.设置SSH Key,在Git Bash中输入:
ssh-keygen –t rsa –C "github register email"
注: github register email这里写你在第二步注册Github账户的邮箱地址
然后按下回车,并设置认证密码(也可不设置)
回车,会得到两个文件:id_rsa(私有密钥),id_rsa.pub是公开密钥。
这两个文件默认在C:\Users\Username\.ssh目录下
4.添加公开密钥:
进入你的Github账户,在右上角选择SettingàSSH keysàAdd SSH key, 其中,Title输入一个名称,在Key处粘贴id_rsa.pub中的内容。
5.此时就可以用私人密钥和Github进行认证和通信,在Git Bash中输入:
ssh –T git@github.com
提示:Are you sure you want to continue connecting (yes/no)?
输入:yes 回车
显示:Hi yourname! You've successfully authenticated, but Github does not provide shell access.
接下来,演示一个Github的HelloWorld示例:
进入Github账户,点击New repository
Repository name输入Hello
Description项输入一些对仓库的描述信息(选填)
Public/Private选项勾选Public
Initialize this repository with a README 选项选上
点击Create Repository即可创建一个Repository
点击进入Hello这个Repository,拷贝这个Repository的Web Address
将Hello这个Repository clone至本地,打开Git Bash,输入:
git clone your repository's Web Address
提示:repository's Web Address就是上一步骤拷贝的URL
Git Bash输入cd Hello,在Hello目录下增加一个文件,比如T.java
将T.java添加到暂存区,Git Bash中输入:
git add T.java
提交T.java, Git Bash中输入:
git commit –m "this is your comment"
Push到Github上的仓库
git push
进入Github账户中的Hello Repository,即可查看push进去T.java这个文件
查看提交日志:
git log
相关文章推荐
- Matlab实现线性回归和逻辑回归: Linear Regression & Logistic Regression
- c++11 之初
- ThinkPHP中的动态缓存(S方法)和快速缓存(F方法)
- java System类详解
- Python 多线程
- qt之VS2008编译
- 初学者如何进行代码重构
- Eclipse中在XML中如何关联.dtd文件
- C++左值和右值
- C# 窗体间传值的几种方法
- A+B for Input-Output Practice (VIII)(没啥用,来凑数)
- Struts框架搭建的几个注意事项
- JAVA代码实现执行CMD命令
- Delphi使用TryStrToDate判断字符串是否为日期格式
- Struts2中的值栈和OGNL
- MMD 编程练习之 LSH
- Java 关键字-violate
- asp.net中三层架构与mvc之区别?
- java.util常用类
- 小项目集锦博客目录(不断更新,总结)