首页 > 其他分享 >github的简单使用方法

github的简单使用方法

时间:2024-07-25 11:28:30浏览次数:7  
标签:git -- demo github com 简单 方法 SSH

想要把代码托管到github上面,之前没有用过,简单记录一下:

注册github账号

注册github账号,这个使用邮箱就能注册,比较方便。

安装git

1.下载git安装包 

进入官网Git (git-scm.com)下载对应版本就行

2.安装

通常全部点击下一步就行了

3.创建密钥对

右键点击Open Git gui here-->help-->Show SSH Key-->GenerateKey-->Copy To Clipboard

这样就把公钥复制到粘贴板了。

创建完成后,密钥对文件存储在%USERPROFILE%/.ssh目录

4.设置github上的SSH

头像菜单-->Setting-->SSH and GPG keys-->new SSH Key
然后粘贴上步骤3复制的公钥

5.设置本地key

在桌面右键打开git bash

输入命令

ssh -T [email protected]

会提示输入yes,按照提示就好,最终会显示succeed

接入继续配置用户名和邮箱,例如我的用户名是demo,邮箱是[email protected]就这样输入

git config --global user.name "demo"
git config --global user.email "[email protected]"

测试提交代码

创建一个github项目,例如最终项目地址是https://github.com/demo/demo.git 这个一定要改成自己的项目地址
1.拉取项目

git clone https://github.com/demo/demo.git

2.添加文件

git add test.txt

3.提交代码

git commit -m "这是提交日志"

4.推代码到github

git push origin main

第一次执行会弹出对话框,用浏览器打开后,点一下里面的授权就行了

 

标签:git,--,demo,github,com,简单,方法,SSH
From: https://www.cnblogs.com/yuandaozhe/p/18322627

相关文章