Github 基本操作命令

1.向 git做自我介绍

git  config --global user.name "注册时的github账号"

git  config --global user.email "github的注册邮箱"

ssh -key 的配置

安装好github之后,打开桌面出现的 软件Gitbash 进入命令行,ssh -keygen -t  rsa -C “注册时的真实邮箱”

直接回车三次就好,

输入密码:就是咱们注册github的密码

——添加ssh key到Github上面

首先登陆Github,点击右上角的向下图标,setting——ssh keys ——add keys

然后在c/user/xxx/.ssh中打开后缀为rsa.pub的文件,复制内容

或者输入cat ~/ssh./id_rsa.pub 也可以得到公钥 最后粘贴到key的输入框中,对于title 自定义即可

配置账户:git config --global.user.name ""  git config --global  user.email ""

测试ssh key是否配置成功

ssh -T [email protected]

The authenticity of host 'github.com (192.30.252.129)' 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 #确认你是否继续联系,输入yes

  Warning: Permanently added 'github.com,192.30.252.129' (RSA) to the list of known hosts.

  Enter passphrase for key '/c/Users/xxxx_000/.ssh/id_rsa': #生成ssh kye是密码为空则无此项,若设置有密码则有此项且,输入生成ssh key时设置的密码即可。

  Hi xxx! You've successfully authenticated, but GitHub does not provide shell access. #出现此句话,说明设置成功。

常用命令:

1、创建仓库(公开)

  点击github右上角的+里面的new repository
  在repository name栏中输入仓库的名称
  description 栏中可以设置仓库的说明
  piblic(公开)通用 private(非公开)收费
  勾选Initialize this repository with a README ,如果想向GitHub添加手中已有的Git仓库,建议不要勾选
  Add.gitignore 下拉框中选择要使用的框架
  Add a license选择添加许可协议文件
  点击create repository按钮,完成仓库的创建

  2、克隆之前首先要选择克隆文件的位置(cd)

clone仓库

git clone [email protected] :用户名/仓库名

3.git status

4.提交

git add 文件名称.拓展名

git commit -m 后面加备注或者解释都可也

git log  提交日志文件

git push 更新github上面的仓库

mkdir 创建仓库

git init 初始化仓库

git status 查看仓库状态

touch 文件名 创建文件

猜你喜欢

转载自blog.csdn.net/qq_41826183/article/details/85164693