我的博客搭建之git的使用
来源:互联网 发布:爱塔传奇 唐大华知乎 编辑:程序博客网 时间:2024/06/05 06:39
写在前面
前天我的github博客搭建好啦,并在本地写了一篇文章我的独立博客(第一篇)利用git将其push到github上,那么,今天就简单记录下git的使用。整个过程是在windows下操作的。
git将本地项目push到github
1.Git]下载地址
git官网是需要翻墙才能下载的,里给出Git-2.9.2-64-bit下载地址(我的是64位系统): Git-2.9.2-64-bit
下载后安装步骤可以参考这里:Win7下Git的安装
2. 创建ssh key–安全传输
打开git guihelp – show ssh key
$ git config --global user.name "wblearn"$ git config --global user.email "your email">查看是否已经存在ssh key是否存在
$ cd ~/.ssh![以上步骤截图](http://upload-images.jianshu.io/upload_images/2556999-463b8867c3907ef7.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
**如果没有则提示: No such file or directory 如果有则进入~.ssh路径下(ls查看当前路径文件,rm * 删除所有文件)生成新的ssh key**>生成ssh key
cd ~ //保持在"~"目录下$ ssh-keygen -t rsa -C "xxxxxx@qq.com"//填写真实的邮箱
Generating public/private rsa key pair.Enter file in which to save the key (/c/Users/xxxx/.ssh/id_rsa): #不填直接回车Enter passphrase (empty for no passphrase): #输入密码(可以为空)Enter same passphrase again: #再次确认密码(可以为空)Your identification has been saved in /c/Users/xxxx/.ssh/id_rsa. #生成的密钥Your public key has been saved in /c/Users/xxxx/.ssh/id_rsa.pub. #生成的公钥![以上步骤截图](http://upload-images.jianshu.io/upload_images/2556999-63e1cdae6971a986.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)>添加ssh key到github
1.打开github→Settings→SSH kyes→Add SSH key2.进入c:/Users/xxxx/.ssh/目录下,打开id_rsa.pub文件,全选复制公钥内容 3.Title自定义,将公钥粘贴到GitHub中Add an SSH key的key输入框,最后”Add Key”
测试ssh key是否设置成功
$ ssh -T git@github.com
The authenticity of host 'github.com (192.30.253.113)' can't be established.RSA key fingerprint is 16:27:xx:xx:xx:xx:xx:4d:eb:df:a6:48.Are you sure you want to continue connecting (yes/no)? yes #确认你是否继续联系,输入yesWarning: Permanently added 'github.com,192.30.253.113' (RSA) to the list of known hosts.Enter passphrase for key '/c/Users/xxxx/.ssh/id_rsa': #生成ssh kye是密码为空则无此项,若设置有密码则有此项且,输入生成ssh key时设置的密码即可。Hi xxx! You've successfully authenticated, but GitHub does not provide shell access. #出现词句话,说明设置成功。
3.将本地项目push到github(git cmd为例)
打开git cmd 将路径设置到项目路径
初始化项目
git init>添加远程仓库
git remote add origin "你自己仓库的地址">push本地项目到远程仓库
git add . //添加所有本地代码到缓冲区git commit -m "first commit"//描述信息git push -u origin master//origin也可以自己命名远程仓库名称
ps:我试了两次没有push成功,可能是网速的原因,第三次push成功,大家要有耐心哦
在github查看自己的项目是否传上去
写在最后
撑着年末,就这样把自己的独立博客搭建好了,还有一个星期就2017了,希望2017自己能不断学习,不断进步,遇见未来更好的自己。
我的独立博客因为刚刚上线,可能会存在一些问题,欢迎大家帮忙测试,当然你也可以fork,star我的模板。
5 1
- 我的博客搭建之git的使用
- 我的git 搭建
- 我的GitHub搭建博客
- 我的博客搭建日志
- 我的博客旅行之Android环境搭建
- 我的博客之行(1)-搭建wordpress
- 写在前言--我的博客搭建之路
- Git使用之搭建基于SSH的Git服务器(上篇)
- 利用git搭建自己的个人博客
- [在github上搭建网站]使用Git搭建我的静态网站-搭建基本环境
- [在github上搭建网站]使用Git搭建我的静态网站-搭建基本环境
- 我的第一篇博客之fullcalendar的使用
- 我的Git的使用
- 我的个人博客搭建记录
- 我的博客博客之路....
- 我的博客之旅
- 我的博客之序
- 我的博客之旅
- Leetcode Merge Two Sorted Lists(合并两个有序表)
- android操作SQLite数据库
- C语言与汇编语言混合编程
- JsonCpp遍历json
- 利用matlab对彩色图像进行取反
- 我的博客搭建之git的使用
- [leetCode]53. Maximum Subarray&&动态规划
- Android数据存储之Sqlite数据库的俩种使用方式
- Android Fragment
- SVN
- 合数世纪
- Android项目实践之菜鸟养成 (二)初识Android
- 递归的调用顺序
- XOR ^