git 建立本地仓库并且推送到github上

引言

我想讲我的笔记备份一份保存到github上去,所以我使用git来完成这个目标。

下载Git

首先下载git,由于我是mac,所以我使用了homebrew,直接使用homebrew 下载。

bash 复制代码
brew install git

创建仓库并本地推送

下载完成之后,我在自己笔记文件的位置建立一个本地仓库

csharp 复制代码
cd /笔记文件夹
git init 

# 配置名字 和 邮箱
git config --global user.name "待输入"
git config --global user.email "待输入"

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

将我的整个文件夹都添加到我的仓库,并提交

sql 复制代码
git add .
git commit -m "待输入【输入提交的explain】"

拿到git密钥

使用 git 生成 密钥

bash 复制代码
# 这里是通过 ed25519 这么一种加密算法来生成 ssh 密钥的一种算法, 后  面"yakcalire@outlook.com" 是一种身份标识,为密钥添加注释
ssh-keygen -t ed25519 -C ssh-keygen -t ed25519 -C 
# 展示密钥
cat ~/.ssh/id_ed25519.pub

添加密钥

然后进入 github网站

在 ssh and GPG keys 中间去添加新的密钥

将刚刚拿到的密钥添加

测试:

perl 复制代码
ssh -T git@github.com
# 将会返回 Hi **! You've successfully authenticated, but GitHub does not provide shell access.

推送

推送:

css 复制代码
git branch
# 返回的是 * main

# 推送这个main
git push -u origin main

完成了将这个笔记上传到了我的github上了

相关推荐
jingshaoqi_ccc6 小时前
GitKraken最后一个免费版本和下载地址
git·github·gitkraken·版本管理工具
乌云暮年6 小时前
Git简单命令
git·gitee·github·batch命令
用户1259265423209 小时前
使用 Docker 搭建 Gitea 并实现 Git HTTP 自动登录
git
一只毛驴12 小时前
谈谈对git stash的理解?
git
长风破浪会有时呀16 小时前
Git 学习笔记
笔记·git·学习
中微子1 天前
Git Rebase 详解:概念、原理与实战示例
git
荔枝吻1 天前
【保姆级喂饭教程】Windows下安装Git Flow
windows·git·git flow
云和数据.ChenGuang1 天前
git中的指令解释
git
小Lu的开源日常1 天前
在 macOS 上设置 SSH 和 Git
git·macos·ssh
eleven_h1 天前
ERROR: Permission to Splode/pomotroid.git deni
git