【实践记录】github仓库的更新

首先登录,参考:记一次github连接本地git_如何连接github-CSDN博客

SSH:

git config --global user.name "GitHubUsername"

git config --global user.email "email@example.com"

ssh-keygen -t ed25519 -C "email@example.com"

默认保存路径:~/.ssh/id_ed25519(私钥)和 id_ed25519.pub(公钥)

复制公钥:Github中Gettings -> SSH and GPG keys -> New SSH Key,粘贴

cat ~/.ssh/id_ed25519.pub

登录检查

ssh -T git@github.com

成功提示:Hi YourUsername! You've successfully authenticated...

首先拉取之前建立的仓库:

git clone https://github.com/JL765/Biostatistics--li.git

把原本存在的文件删除掉,这个文件可以记录本地仓库的修改情况

将之前的博客中的代码打包到文件夹中:【R】Dijkstra算法求最短路径_r语言最短路径问题-CSDN博客

加注释说明:

echo "# 项目名称" > README.md # 生成包含标题的 README.md

添加修改到缓存区

git add . # 添加所有更改

声明修改情况:

git commit -m "Initial commit: Dijkstra算法实现"

git status # 确保所有变更已提交

在仓库文件夹中右键打开GitBase,关联远程仓库:

git remote add origin git@github.com:用户名/仓库名.git # 使用SSH地址

检查关联情况

git remote -v

git branch # 确认当前分支(如`main`或`master`)

同步更新情况

git pull --rebase

首次推送

git push -u origin 分支名

仓库更新

git push # 自动推送到已关联的远程分支

分支

git branch -M main # 重命名分支

git push -u origin main

git push origin 本地分支名:远程分支名 # 如 `git push origin dev:feature-dev`

相关推荐
AlenTech2 分钟前
207. 课程表 - 力扣(LeetCode)
算法·leetcode·职场和发展
练习时长一年1 小时前
LeetCode热题100(杨辉三角)
算法·leetcode·职场和发展
lzllzz231 小时前
bellman_ford算法
算法
栈与堆1 小时前
LeetCode 19 - 删除链表的倒数第N个节点
java·开发语言·数据结构·python·算法·leetcode·链表
sunfove1 小时前
麦克斯韦方程组 (Maxwell‘s Equations) 的完整推导
线性代数·算法·矩阵
羊羊羊i1 小时前
使用Informer监听K8s资源
云原生·容器·kubernetes
Rui_Freely1 小时前
Vins-Fusion之 SFM准备篇(十二)
人工智能·算法·计算机视觉
阿里嘎多学长1 小时前
2026-01-11 GitHub 热点项目精选
开发语言·程序员·github·代码托管
三两肉2 小时前
HTTPS ECDHE 握手全解析
网络协议·https·github·rsa·echde
yyy(十一月限定版)2 小时前
matlab矩阵的操作
算法·matlab·矩阵