Github的基本配置与使用
2015-03-04 16:10
323 查看
第一步:尝试创建SSH key
默认在~/.ssh目录生成id_rsa与id_rsa.pub。
-t代表密钥类型,常见的类型有rsa1(SSH-1) 、rsa(SSH-2)、dsa(SSH-2)等;如果没有指定则默认生成用于SSH-2的rsa密钥。
-C表示提供一个新注释
第二步:在github.com的后台添加SSH key,title随意写,通过下面的命令拷贝SSH文本串:
第三步:验证连接是否有效
-T的解释是Disable pseudo-tty allocation. 不占用 shell 了。("it is important to do ssh test connection with -T, because some server could abort the transaction entirely if a text-terminal (tty) is requested.”)
如果是第一次连接会提示是否continue,输入yes就会看到:You’ve successfully authenticated, but GitHub does not provide shell access 。这就表示已成功连上github。
第四步:在github.com建立新仓库(Repository)
按照表单填写相应内容即可。仓库建立后,页面会提示一些基本操作指令,如图所示:
下面是一些常见操作和注意点:
获取(Pull)
提交(Push)
当你输入“git branch”时显示本地分支(local branches)
当你输入“git branch -r”时显示[b]远程跟踪分支(local branches)
[/b]
提交多个文件
修改文件后提交
$git commit -a里的-a是把unstaged的文件变成staged(这里不包括新建(untracked)的文件),然后commit。
ssh-keygen -t rsa -C xxxxx@gmail.com
默认在~/.ssh目录生成id_rsa与id_rsa.pub。
-t代表密钥类型,常见的类型有rsa1(SSH-1) 、rsa(SSH-2)、dsa(SSH-2)等;如果没有指定则默认生成用于SSH-2的rsa密钥。
-C表示提供一个新注释
第二步:在github.com的后台添加SSH key,title随意写,通过下面的命令拷贝SSH文本串:
pbcopy < ~/.ssh/id_rsa.pub
第三步:验证连接是否有效
ssh -T git@github.com
-T的解释是Disable pseudo-tty allocation. 不占用 shell 了。("it is important to do ssh test connection with -T, because some server could abort the transaction entirely if a text-terminal (tty) is requested.”)
如果是第一次连接会提示是否continue,输入yes就会看到:You’ve successfully authenticated, but GitHub does not provide shell access 。这就表示已成功连上github。
第四步:在github.com建立新仓库(Repository)
按照表单填写相应内容即可。仓库建立后,页面会提示一些基本操作指令,如图所示:
下面是一些常见操作和注意点:
获取(Pull)
$cd 当前目录 $git init $git pull git@github.com:xxx/xxx.git
提交(Push)
$cd 当前目录 $git init $git add . 或 git add test.txt $git commit -m "first commit" $git remote add alias git@github.com:xxxxx/xxxxx.git $git push alias master
当你输入“git branch”时显示本地分支(local branches)
$ git branch debian server * master
当你输入“git branch -r”时显示[b]远程跟踪分支(local branches)
[/b]
$ git branch -r cognac/master fruitfly/server origin/albert origin/ant origin/contrib origin/cross-compile
提交多个文件
$git add file1.txt $git add file2.txt $git add file3.txt $git commit -m "add 3 files."
修改文件后提交
$git commit -a -m "modify file1" $git push alias master
$git commit -a里的-a是把unstaged的文件变成staged(这里不包括新建(untracked)的文件),然后commit。
相关文章推荐
- 使用GitHub + Hexo搭建个人博客(七)- 基本配置
- <基础知识>github配置和基本使用
- 玩转GitHub之基本配置及使用
- github,git 入门配置和基本使用
- Centos6.7或7.2系统中 github配置及基本使用
- commons.logging1.1.1源代码研究(2)-- 基本使用及配置文件
- 在Android模拟器中使用google maps的基本配置
- 如何使用svconfigeditor.exe编辑WCF Service配置文件-配置一个基本的Endpoint(一)
- WebWork之--使用fileUpload interceptor实现文件上传[基本配置+注意事项]
- Log4j使用基本配置
- sersync2 完全安装配置说明(三) ----插件基本配置和使用
- Hibernate Search基本配置和使用
- Hibernate Search基本配置和使用
- sersync2 完全安装配置说明(一) ----基本功能使用
- sersync2 完全安装配置说明(三) ----插件基本配置和使用
- 基本action的基本配置与使用
- hibernate 基本配置和使用
- Cisco PIX防火墙基本配置命令使用
- FCKeditor基本配置优化修改使用方法