Git基础使用

Git基础使用


安装

初始化git

git config --global user.name 'xxxxx'
git config --global user.email 'xxx@xx.xxx'

生成秘钥

注:秘钥生成位置:~/.ssh

  • windows:C:\Users\Liu\.ssh
  • linux:/home/.ssh
ssh-keygen -t rsa -C 'xxx@xx.xxx'

项目维度

初始化项目

git init

克隆

git clone address

常见配置命令

## 查看全局配置
git config --global --list


IDE使用github

连接repository

  1. git bash:生成秘钥ssh-keygen -t rsa -C 'xxx@xx.xxx'
  2. git hub:配置ssh key,将生成的id_rsa.pub公钥文件写入https://github.com/settings/keys
  3. git hub:在github创建repository,并拷贝ssh连接(https连接国内可能连接不上)
  4. IDEA:git - manage remotes中,使用ssh连接添加远程仓库(如果没有配置秘钥或账号会添加失败)
  5. IDEA:选择remote及branches,Push/Pull

|
7. IDEA:创建local branches

Intellij IDE连接github

准备工作

  1. git bash:完成git初始化。
  2. git bash:生成秘钥 ssh-keygen -t rsa -C 'xxx@xx.xxx',并写入github
  3. git hub:在github创建repository,并拷贝ssh连接(https连接国内可能连接不上)

IDEA使用github

连接repository(IDEA中操作)
  1. git - manage remotes中,使用ssh连接添加远程仓库(如果没有配置秘钥或账号会添加失败)
在这里插入图片描述在这里插入图片描述
  1. 选择remote及branches,Push/Pull
图2图1
  1. 创建local branches
    在这里插入图片描述

VScode使用github

连接github
  1. 添加remote,第一步输ssh连接,回车后输remote name
    等效于命令git remote add master ssh连接
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述

  2. 点击删除远程存储库查看是否添加成功​(别真删)
    等效于命令 git remote -v
    在这里插入图片描述

  3. 创建本地分支

在这里插入图片描述在这里插入图片描述
  1. Push/Pull
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值