【实践记录】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`

相关推荐
Phil32310 分钟前
多智能体不是越多越好:Google《Towards a Science of Scaling Agent Systems》论文深度解读
算法
6Hzlia11 分钟前
【Classic 150 刷题计划】 LeetCode 26. 删除有序数组中的重复项 | C++ 快慢双指针经典模板
c++·算法·leetcode
huang5791471 小时前
基于滑动窗口的流式数据算法优化思路3
算法
cui_hao_nan1 小时前
从零搭建 Kubernetes 集群:Ubuntu + kubeadm 完整实战
ubuntu·容器·kubernetes
Ulyanov1 小时前
AudioVision Pro:基于 PySide6 + sounddevice 的实时音频可视化播放器设计
python·算法·音视频
fb_123451 小时前
Docker入门-第3章-容器镜像深度解析
运维·docker·容器
土司大王1 小时前
LeetCode hot100——74.搜索二维矩阵:Java 二分模板
java·算法·leetcode
tyler_download1 小时前
揉扁搓圆transformer架构:NAG优化器算法详解
深度学习·算法·transformer
weixin199701080161 小时前
[特殊字符]《京东POP二手品类对接:B2C订单模型 vs 二手C2C属性的字段转换难题》(附Python源码)
前端·python·算法
lbb 小魔仙2 小时前
Python 项目 CI/CD 实战:用 GitHub Actions 搭建自动化测试、覆盖率与发布流水线
python·ci/cd·github