当前位置:   article > 正文

从零开始-Git配置使用_从0开始配置git

从0开始配置git

一、配置 SSH Key 免密登录

GitHub配置SSH Key的目的是为了帮助我们在通过git提交代码是,不需要繁琐的验证过程,简化操作流程。

1.安装git客户端 https://git-scm.com/downloads

2.在你的项目文件夹右键弹框,点击Git Bash Here

 

3.配置用户名邮箱:

a)输入:Git init    (初始化git环境)

    b)git config --global user.name "xxx"    (github的用户名)

c)git config --global user.email  xxx@qq.com    (github的邮箱)

4.创建密钥,依次输入:

cd ~

rm –r .ssh

ssh-keygen -t rsa -C xxx@qq.com (你的github邮箱地址,一路回车)

 

5.在当前用户目录下\.ssh生成密钥,用文本编辑器打开,全选-复制:

 

二、在 github 中新增SSH Key

1.登录GitHub-点击用户头像-Settings:

 

2.SSH and GPG keys:

 

3.New SHH Key

 

4.输入标题(标题随意)及公钥信息(上面复制 id_rsa.pub 文件内容)

 

7.输入密码

 

8 .完成

 

9.测试是否成功,输入: ssh -T git@github.com

 

三、创建github repository(仓库)

1.github上创建:create-New repository,输入Repository name,创建。

 

2. 在你的项目文件夹右键弹框,点击Git Bash Here,依次输入:

a)git init

b)git add.  (添加全部)

c)git commit -m "提交描述"

d)git branch -M main

e)git remote add origin git@github.com:sueleeyu/arunitylib.git (你的仓库地址)

 

f)如果出现:error: remote origin already exists.执行:

git remote rm origin

g)再次执行

git remote add origin git://github.com/xxx/arunitylib.git

h)git push -u origin main

 

 

四、参考和代码

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/581034
推荐阅读
相关标签
  

闽ICP备14008679号