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

相关推荐
小灰灰的FPGA36 分钟前
29.9元汉堡项目:基于matlab+FPGA的FFT寻峰算法实现
算法·matlab·fpga开发
Rinleren1 小时前
企业级 K8s 运维实战:集群搭建、微服务暴露(Ingress)、监控告警(Prometheus)全流程
java·容器·kubernetes
花心蝴蝶.1 小时前
JVM 垃圾回收
java·jvm·算法
im_AMBER2 小时前
hello算法笔记 02
笔记·算法
小闫BI设源码2 小时前
Docker Swarm主机编排
运维·docker·容器·容器编排·docker compose·依赖管理·多服务启动
Michelle80232 小时前
决策树习题
算法·决策树·机器学习
hn小菜鸡2 小时前
LeetCode 2540.最小公共值
数据结构·算法·leetcode
Tisfy2 小时前
LeetCode 0611.有效三角形的个数:双指针
算法·leetcode·题解·双指针
Keying,,,,2 小时前
力扣hot100 | 多维动态规划 | 62. 不同路径、64. 最小路径和、5. 最长回文子串、1143. 最长公共子序列、72. 编辑距离
算法·leetcode·动态规划
Reicher2 小时前
Docker的介绍和使用
运维·docker·容器