20181114-python学习 申请github和git使用

一、申请github账号并创建一个项目study
github地址:https://github.com/lijianan273/studypy
二、git使用
1、本地centos7安装git
yum install git
2、配置git 免密互信
(1)ssh-keygen -t rsa -C "lijianan273@gmail.com" 首先在本地创建ssh key;
ssh -T git@github.com 验证是否成功
(2)编辑github ssh配置
进入编辑环境变量新增ssh key,将刚才在centos7本地生成的id_rsa.pub内容拷贝进去,然后点击新增(3)测试是否配置成功;
ssh -T git@github.com
(4)把本地仓库传到github上去,在此之前还需要设置username和email,因为github每次commit都会记录他们。
git config --global user.name “lijianan273”
git config --global user.email "lijianan273@gmail.com"
(5) 进入要上传的仓库,右键git bash,添加远程地址:
git remote add origin https://github.com/lijianan273/studypy.git

3、git日常操作
(1)将远端仓库clone到本地
git clone https://github.com/lijianan273/studypy.git
(2)将本地文件提交到远端仓库,修改文件后
git add * 可以指定文件名提出更改,添加到暂存区
git commit -m “your comment” 提交到了本地仓库的head
git push origin master 提交到远端仓库
(3)git remote -v 查看clone地址
(4)如果想使用免密登录
git remote rm origin 命令移除HTTPS的方式
git remote add origin git@github.com:lijianan273/studypy.git 在页面上切换成ssh方式后复制地址

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值