git使用教程

windows下使用git的方法

目录

一、准备工作

  • 注册一个github账号
  • 安装Git
  • 官网(https://git-scm.com/)

二、在github上的配置

1、新建一个仓库名

  • 仓库名字必须是: username.github.io ,其中username是你的用户名;
    github用户名

2、新建一个工程

在这里插入图片描述

3、配置SSH key(=>Settings)

第1步: Git 中 SSH key 生成步骤
(在windows下打开git bash,在控制台中输入以下命令。)

$ ssh-keygen -t rsa -C “youremail@example.com”

在这里插入图片描述

在自己电脑中C:\Users\Administrator.ssh路径下生成下面两个文件:
id_rsa
id_rsa.pub

第2步:登录github。打开setting->SSH keys,点击右上角 New SSH key,把生成好的公钥id_rsa.pub放进 key输入框中y。
ssh图片
提交代码到git肯定要拥有你的github权限才可以,使用ssh key来解决本地和服务器的连接问题

4、测试下,增加个文件上传到仓库看看能否成功,在windows下git bash中操作

>…or create a new repository on the command line
echo "# read" >> test1   (把# read写入 test1 )
git init      			 (初始化)
git add test1      		 (向仓库中添加README.md文件)
git commit -m "first commit" (提交备注)
git remote add origin https://github.com/411forget/test.git    (添加要提交到哪个仓库)
git push -u origin master    (从本地向远端推送提交的文件)

查看github中有没有推送的文件:
在这里插入图片描述
4. 使用git克隆的方式,之后的更新可以通过 git pull 来快速更新使用git克隆的方式,之后的更新可以通过 git pull 来快速更新
步骤如下:

$ cd /e/WorkSpaces/hexo/

$ git clone https://github.com/iissnan/hexo-theme-next.git themes/next

持续更新


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值