GitHub操作

    xiaoxiao2023-09-27  144

    先下载 git bash

    git配置SSH Key

    在 git bash 上操作

    git配置全局的name和email

    git config --global user.name "name" git config --global user.email "email"

    检查是否已经有SSH Key

    cd ~/.ssh

    如果有的话就是这几个文件 ,最下面的额known_hosts 是在GitHub上配置了sshkey才生成的文件 生成SSH Key 此电脑第一次生成的话,直接一路回车,不需要输入GitHub密码。不是第一次生成的话,会提示 overwrite (yes/n0)? 问你是否覆盖旧的 SSH Key ,直接填 y ,然后一直回车就行了,最后得到了两个文件:id_rsa和id_rsa.pub。 注意有些可能要输入密码才能创建成功。

    ssh-keygen -t rsa -C "youremail"

    将 git bash 生成的密匙输入到GitHub上

    记事本打开/.ssh/下id_rsa.pub文件,复制该段信息;登录github账户,点击头像进入Settings -> SSH and GPG keys -> New SSH key,将复制的信息粘贴到该处。并不需要写title

    测试是否操作成功

    在git bash 上输入 ssh -T git@github.com 提示“Hi xxx! You've successfully authenticated, but GitHub does not provide shell access.”说明添加成功。

    如何打开git bash 就进入 项目所在目录

    选中Git Bash图标,右键,选中“属性”,打开如图: 去掉–cd-to-home,修改“起始位置”为自定义的git 本地仓库的路径,如:E:\Woce\GitLabel 在这里插入图片描述 再次打开Git Bash时已经修改了默认路径: Git CMD 也如上修改,将快捷方式中路径修改为自定义路径即可,这样每次打开Git Bash 和Git CMD就自己进入本地的Git Repository里面了。

    最新回复(0)