怎么用网吧电脑做网站服务器/百度账号怎么改用户名
更新项目
当自己的本地项目与 远程的github 的仓库已经建立远程连接时, 则直接按照下面的步骤,
将本地的项目代码更新到远程仓库。
# Stage the resolved file
git add README.md <file1> <file2># To stage all changes:
git add .# Commit the merge
git commit -m "Resolved merge conflict in README.md"# Push the changes
git push origin main
如果在此之前, 自己的本地仓库并没有与远程的仓库建立连接时, 则先需要按照下面的步骤进行连接建立。
1. 建立连接
由于github在 2021 年开始, 取消使用密码登录的方式, 因此 这里推荐使用第二种 通过ssh 连接的方式,进行登录。
The error occurs because GitHub no longer supports password-based authentication for HTTPS URLs (as of August 13, 2021). Instead, you need to use one of the following authentication methods:
Option 1: Use a Personal Access Token (PAT)
GitHub now requires a Personal Access Token (PAT) instead of a password for HTTPS authentication.
Steps:
-
Generate a PAT:
- Go to your GitHub account settings: GitHub Tokens.
- Click Generate new token.
- Select the appropriate scopes (e.g.,
repo
for full control of private repositories). - Generate the token and copy it (you won’t be able to see it again).
-
Use the PAT for Authentication:
- When prompted for a password, paste the PAT instead of your GitHub password.
Example:
Username for 'https://github.com': your_account Password for 'https://xxxxx@github.com': <paste-your-PAT-here>
Option 2: Use SSH Authentication
SSH is a more secure and convenient way to authenticate with GitHub.
Steps:
- Generate an SSH Key (if you don’t already have one):
- Run the following command in your terminal:
ssh-keygen -t ed25519 -C "your_email@example.com"
- Press Enter to accept the default file location and passphrase (optional).
- Run the following command in your terminal:
The command ssh-keygen -t ed25519 -C "your_email@example.com"
is used to generate a new SSH key pair for secure authentication with remote servers, such as GitHub. Let’s break down the command and its components:
Command Breakdown
-
ssh-keygen
:- This is the command-line tool used to generate, manage, and convert SSH keys.
-
-t ed25519
:- The
-t
flag specifies the type of key to generate. ed25519
is a cryptographic algorithm used to create the key pair. It is a modern, secure, and efficient algorithm based on elliptic curve cryptography.- You can replace
ed25519
with other algorithms, such as:rsa
: Older but widely supported algorithm (e.g.,-t rsa -b 4096
generates a 4096-bit RSA key).ecdsa
: Elliptic Curve Digital Signature Algorithm (e.g.,-t ecdsa -b 521
generates a 521-bit ECDSA key).dsa
: Older and less secure (not recommended).
- The
-
-C "your_email@example.com"
:- The
-C
flag adds a comment to the key, which is typically your email address or a label to help identify the key. - This comment is embedded in the public key file and is useful for keeping track of which key is associated with which account or purpose.
- The
Why Use Different Algorithms (-t
Options)?
You can use different algorithms (ed25519
, rsa
, ecdsa
, etc.) for different repositories or purposes, but this is not common practice. Instead, people usually generate one key per machine or purpose and reuse it across multiple repositories. However, here are some reasons you might use different algorithms:
-
Compatibility:
- Some older systems or services may not support modern algorithms like
ed25519
. In such cases, you might need to usersa
orecdsa
.
- Some older systems or services may not support modern algorithms like
-
Security Requirements:
- If you have specific security requirements, you might choose an algorithm based on its strength or performance characteristics.
-
Organizational Policies:
- Some organizations enforce specific key types for compliance or standardization.
How to Use Different Keys for Different Repositories
If you want to use different SSH keys for different repositories, you don’t need to generate keys with different algorithms. Instead, you can:
- Generate multiple SSH key pairs (e.g., one for work and one for personal use).
- Add the keys to your SSH agent.
- Configure your SSH client to use the appropriate key for each repository using the
~/.ssh/config
file.
Summary
- The command
ssh-keygen -t ed25519 -C "your_email@example.com"
generates a secure SSH key pair using theed25519
algorithm. - You can use different algorithms (
-t
options) for compatibility or specific requirements, but it’s not necessary for managing multiple repositories. - To use different keys for different repositories, generate multiple keys and configure them in your
~/.ssh/config
file.
Let me know if you need further clarification!
-
Add the SSH Key to Your GitHub Account:
- Copy the public key to your clipboard:
cat ~/.ssh/id_ed25519.pub
- Go to your GitHub account settings: GitHub SSH Keys.
- Click New SSH key, give it a title, and paste the public key.
- Copy the public key to your clipboard:
-
Change the Remote URL to SSH:
这里注意 使用的 git@github.com
- Update your remote repository URL to use SSH instead of HTTPS:
git remote set-url origin git@github.com:xxxx_name/respitory.git
这里需要注意, 你远程的仓库 使用的是main 还是 master.
- Now you can push without entering a username or password:
git push origin main
Option 3: Use GitHub CLI
If you have the GitHub CLI installed, you can authenticate using the gh
command.
Steps:
- Install the GitHub CLI: GitHub CLI Installation.
- Authenticate with GitHub:
gh auth login
- Follow the prompts to log in and authorize the CLI.
Option 4: Use a Credential Helper
You can configure Git to remember your credentials.
Steps:
- Enable the credential helper:
git config --global credential.helper store
- Push your changes. The first time, you’ll be prompted for your username and PAT. After that, Git will remember your credentials.
Summary
- Recommended: Use a Personal Access Token (PAT) or switch to SSH for authentication.
- If you’re unsure, start with the PAT method.
2. 处理冲突
当远程仓库和本地仓库发生冲突时, 需要先解决冲突
我们正常更新时的状态是, 远程仓库的文件在本地是具有的,
而如果远程的文件在本地中不存在时, push 时就会存在冲突, 此时需要先需要拉取远程中的文件,然后,根据自己的选择,进行更新或者更改, 之后在推送。
The error indicates that the remote repository has changes that you don’t have locally, and Git is preventing you from overwriting those changes. To resolve this, you need to pull the remote changes first, merge them with your local changes, and then push your updates.
Steps to Fix the Issue:
-
Pull the Remote Changes:
Run the following command to fetch and merge the remote changes into your local branch:git pull origin main
- If you’re using SSH, it will look like this:
git pull origin main
- If you’re using HTTPS, it will prompt you for your GitHub username and Personal Access Token (PAT).
- If you’re using SSH, it will look like this:
-
Resolve Conflicts (if any):
- If there are merge conflicts, Git will notify you. Open the conflicting files, resolve the conflicts, and save the changes.
- After resolving conflicts, stage the resolved files:
git add <file1> <file2>
-
Commit the Merge:
If there were conflicts, commit the merge:git commit -m "Merge remote changes into local branch"
-
Push Your Changes:
Once the remote changes are merged with your local changes, push your updates:git push origin main
Optional: Force Push (Not Recommended)
If you’re sure you want to overwrite the remote changes (e.g., if you’re working alone and don’t care about the remote changes), you can force push:
git push --force origin main
Warning: Force pushing can overwrite remote changes, so use it with caution, especially in collaborative environments.
Summary of Commands:
git pull origin main
# Resolve conflicts if any
git add .
git commit -m "Merge remote changes"
git push origin main
3. 手动解决冲突
The git pull
command resulted in a merge conflict in the README.md
file. This happens when Git cannot automatically merge changes from the remote repository with your local changes. You’ll need to manually resolve the conflict before proceeding.
Steps to Resolve the Conflict:
- Open the Conflicted File:
Open theREADME.md
file in your text editor or IDE. You’ll see conflict markers like this:<<<<<<< HEAD Local changes ======= Remote changes >>>>>>> 7006db8
注意, 等号线上方的代表的本地仓库中的内容, 等号线下面的代表的是远程仓库中的内容,
需要根据自己的需求, 进行更改。
<<<<<<< HEAD
indicates the start of your local changes.=======
separates your local changes from the remote changes.>>>>>>> 7006db8
indicates the end of the remote changes.
-
Resolve the Conflict:
Edit the file to keep the changes you want. For example:- Keep both changes:
Local changes Remote changes
- Keep only local changes:
Local changes
- Keep only remote changes:
Remote changes
Remove the conflict markers (
<<<<<<<
,=======
, and>>>>>>>
) after resolving. - Keep both changes:
-
Stage the Resolved File:
Once you’ve resolved the conflict, stage the file:git add README.md
-
Commit the Merge:
Commit the resolved changes:git commit -m "Resolved merge conflict in README.md"
-
Push Your Changes:
Push the resolved changes to the remote repository:git push origin main
Example Workflow:
# Open README.md and resolve conflicts
nano README.md# Stage the resolved file
git add README.md# Commit the merge
git commit -m "Resolved merge conflict in README.md"# Push the changes
git push origin main
Additional Notes:
- If you’re unsure how to resolve the conflict, you can use a merge tool like
meld
,kdiff3
, or the built-in tools in your IDE (e.g., VS Code). - To abort the merge and start over (if needed), run:
git merge --abort
小结
全局配置git 上的用户名和email:
git config --global user.name "username"git config --global user.email 1234567@email.com
在本地的client 的git, 配置git初始化默认的分支由master 变为main;
git config --global init.defaultBranch main
upload
一 : 上传大量文件(适用于在github上 刚新建一个的仓库A)
1.在本地新建工程文件夹T,将所有待上传的文件拷贝到T中;
2.在T中空白处,点击git bash here; 在github 上点击copy 刚刚仓库A的地址;
3.使用 git clone “仓库A的地址” ,从github 上拉取该仓库到本地;
4.在本地T中, cd到仓库A的路径下,注意到此时在显示 (main),代表进入到该仓库中;
5.在T中将待上传的文件拷贝到 仓库A中, 输入 “git add .” ,注意空格和点号;
6.输入 git commit -m “your logs infor” ;
7.输入 git push -u origin main, 将本地仓库push 到 github 上面,完成代码上传。
note: git add . : 是将当前目录下所有文件添加到 待上传区域;
git add xx.txt : 可以指定当前目录下待上传的文件;
git push -u origin main: -u 代表首次提交, 后续更新提交时,可以不用;
remote
二:本地仓库远程连接到 github 上已经有的仓库。
1.在本地文件夹T中空白处,点击git bash here; 输入git init;
2.将本地的仓库关联到Github上:
git remote add origin https://github.com/h-WAVES/test0913
-
选中待上传的文件, 文件之间空格隔开;
git add file1 fiel2; -
备注此次操作的信息
git commit -m “logs” -
上传之前先进行Pull 确认一下;如果在github上初始化仓库时,使用第二个;
git pull origin main
git pull --rebase origin main -
待上传的文件push 到远程仓库中;
git push origin main
## delete
三 删除远程仓库中的文件夹1.在本地文件夹T中空白处,点击git bash here; 输入git init;2.git clone 项目地址, cd 到该对应的路径下 3.git rm -r folder/4. git commit -m "delete folder"5. git push origin main完成删除
OpenSSL SSL_read: Connection was reset, errno 10054; 解除SSL 验证:
git config --global http.sslVerify "false"
当github 创建仓库时,选择了初始化.gitignore 和 README.md 时,
此时在github 上和本地的仓库由于文件的不同出现不匹配的情况:对于error: failed to push some refsto‘远程仓库地址’git pull --rebase origin main
相关文章:

git 项目的更新
更新项目 当自己的本地项目与 远程的github 的仓库已经建立远程连接时, 则直接按照下面的步骤, 将本地的项目代码更新到远程仓库。 # Stage the resolved file git add README.md <file1> <file2># To stage all changes: git add .# Comm…...

【Rust自学】17.3. 实现面向对象的设计模式
喜欢的话别忘了点赞、收藏加关注哦,对接下来的教程有兴趣的可以关注专栏。谢谢喵!(・ω・) 17.3.1. 状态模式 状态模式(state pattern) 是一种面向对象设计模式,指的是一个值拥有的内部状态由数个状态对象(…...

51c视觉~CV~合集10
我自己的原文哦~ https://blog.51cto.com/whaosoft/13241694 一、CV创建自定义图像滤镜 热图滤镜 这组滤镜提供了各种不同的艺术和风格化光学图像捕捉方法。例如,热滤镜会将图像转换为“热图”,而卡通滤镜则提供生动的图像,这些图像看起来…...

如何安全地管理Spring Boot项目中的敏感配置信息
在开发Spring Boot应用时,我们经常需要处理一些敏感的配置信息,比如数据库密码、API密钥等。以下是一个最佳实践方案: 1. 创建配置文件 application.yml(版本控制) spring:datasource:url: ${MYSQL_URL:jdbc:mysql…...

Docker小游戏 | 使用Docker部署2048网页小游戏
Docker小游戏 | 使用Docker部署2048网页小游戏 前言项目介绍项目简介项目预览二、系统要求环境要求环境检查Docker版本检查检查操作系统版本三、部署2048网页小游戏下载镜像创建容器检查容器状态检查服务端口安全设置四、访问2048网页小游戏五、总结前言 在当今快速发展的技术世…...

RabbitMQ深度探索:消息幂等性问题
RabbitMQ 消息自动重试机制: 让我们消费者处理我们业务代码的时候,如果抛出异常的情况下,在这时候 MQ 会自动触发重试机制,默认的情况下 RabbitMQ 时无限次数的重试需要认为指定重试次数限制问题 在什么情况下消费者实现重试策略…...

Linux网络 | 进入数据链路层,学习相关协议与概念
前言:本节内容进入博主讲解的网络层级中的最后一层:数据链路层。 首先博主还是会线代友友们认识一下数据链路层的报文。 然后会带大家重新理解一些概念,比如局域网交换机等等。然后就是ARP协议。 讲完这些, 本节任务就算结束。 那…...

芝法酱学习笔记(2.6)——flink-cdc监听mysql binlog并同步数据至elastic-search和更新redis缓存
一、需求背景 在有的项目中,尤其是进销存类的saas软件,一开始为了快速把产品做出来,并没有考虑缓存问题。而这类软件,有着复杂的业务逻辑。如果想在原先的代码中,添加redis缓存,改动面将非常大,…...

JavaScript系列(58)--性能监控系统详解
JavaScript性能监控系统详解 📊 今天,让我们深入探讨JavaScript的性能监控系统。性能监控对于保证应用的稳定性和用户体验至关重要。 性能监控基础概念 🌟 💡 小知识:JavaScript性能监控是指通过收集和分析各种性能指…...

GESP2023年12月认证C++六级( 第三部分编程题(1)闯关游戏)
参考程序代码: #include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> #include <string> #include <map> #include <iostream> #include <cmath> using namespace std;const int N 10…...

git 新项目
新项目git 新建的项目如何进行git 配置git git config --global user.name "cc" git config --global user.email ccexample.com配置远程仓库路径 // 添加 git remote add origin http://gogs/cc/mc.git //如果配错了,删除 git remote remove origin初…...

系统URL整合系列视频一(需求方案)
视频 系统URL整合系列视频一(需求方案) 视频介绍 (全国)某大型分布式系统Web资源URL整合需求实现方案讲解。当今社会各行各业对软件系统的web资源访问权限控制越来越严格,控制粒度也越来越细。安全级别提高的同时也增…...

Vue.js 使用组件库构建 UI
Vue.js 使用组件库构建 UI 在 Vue.js 项目中,构建漂亮又高效的用户界面(UI)是很重要的一环。组件库就是你开发 UI 的好帮手,它可以大大提高开发效率,减少重复工作,还能让你的项目更具一致性和专业感。今天…...

计算图 Compute Graph 和自动求导 Autograd | PyTorch 深度学习实战
前一篇文章,Tensor 基本操作5 device 管理,使用 GPU 设备 | PyTorch 深度学习实战 本系列文章 GitHub Repo: https://github.com/hailiang-wang/pytorch-get-started PyTorch 计算图和 Autograd 微积分之于机器学习Computational Graphs 计算图Autograd…...

51单片机入门_05_LED闪烁(常用的延时方法:软件延时、定时器延时;while循环;unsigned char 可以表示的数字是0~255)
本篇介绍编程实现LED灯闪烁,需要学到一些新的C语言知识。由于单片机执行的速度是非常快的,如果不进行延时的话,人眼是无法识别(停留时间要大于20ms)出LED灯是否在闪烁所以需要学习如何实现软件延时。另外IO口与一个字节位的数据对应关系。 文…...

如何获取sql数据中时间的月份、年份(类型为date)
可用自带的函数month来实现 如: 创建表及插入数据: create table test (id int,begindate datetime) insert into test values (1,2015-01-01) insert into test values (2,2015-02-01) 执行sql语句,获取月份: select MONTH(begindate)…...

【单层神经网络】softmax回归的从零开始实现(图像分类)
softmax回归 该回归分析为后续的多层感知机做铺垫 基本概念 softmax回归用于离散模型预测(分类问题,含标签) softmax运算本质上是对网络的多个输出进行了归一化,使结果有一个统一的判断标准,不必纠结为什么要这么算…...

使用开源项目:pdf2docx,让PDF转换为Word
目录 1.安装python 2.安装 pdf2docx 3.使用 pdf2docx 转换 PDF 到 Word pdf2docx:GitCode - 全球开发者的开源社区,开源代码托管平台 环境:windows电脑 1.安装python Download Python | Python.org 最好下载3.8以上的版本 安装时记得选择上&#…...

保姆级教程Docker部署KRaft模式的Kafka官方镜像
目录 一、安装Docker及可视化工具 二、单节点部署 1、创建挂载目录 2、运行Kafka容器 3、Compose运行Kafka容器 4、查看Kafka运行状态 三、集群部署 四、部署可视化工具 1、创建挂载目录 2、运行Kafka-ui容器 3、Compose运行Kafka-ui容器 4、查看Kafka-ui运行状态 …...

ChatGPT提问技巧:行业热门应用提示词案例--咨询法律知识
ChatGPT除了可以协助办公,写作文案和生成短视频脚本外,和还可以做为一个法律工具,当用户面临一些法律知识盲点时,可以向ChatGPT咨询获得解答。赋予ChatGPT专家的身份,用户能够得到较为满意的解答。 1.咨询法律知识 举…...

openRv1126 AI算法部署实战之——Tensorflow模型部署实战
在RV1126开发板上部署Tensorflow算法,实时目标检测RTSP传输。视频演示地址 rv1126 yolov5 实时目标检测 rtsp传输_哔哩哔哩_bilibili 一、准备工作 从官网下载tensorflow模型和数据集 手动在线下载: https://github.com/tensorflow/models/b…...

STM32 TIM定时器配置
TIM简介 TIM(Timer)定时器 定时器可以对输入的时钟进行计数,并在计数值达到设定值时触发中断 16位计数器、预分频器、自动重装寄存器的时基单元,在72MHz计数时钟下可以实现最大59.65s的定时 不仅具备基本的定时中断功能ÿ…...

51单片机 05 矩阵键盘
嘻嘻,LCD在RC板子上可以勉强装上,会有一点歪。 一、矩阵键盘 在键盘中按键数量较多时,为了减少I/O口的占用,通常将按键排列成矩阵形式;采用逐行或逐列的“扫描”,就可以读出任何位置按键的状态。…...

SSRF 漏洞利用 Redis 实战全解析:原理、攻击与防范
目录 前言 SSRF 漏洞深度剖析 Redis:强大的内存数据库 Redis 产生漏洞的原因 SSRF 漏洞利用 Redis 实战步骤 准备环境 下载安装 Redis 配置漏洞环境 启动 Redis 攻击机远程连接 Redis 利用 Redis 写 Webshell 防范措施 前言 在网络安全领域࿰…...

kubernetes学习-配置管理(九)
一、ConfigMap (1)通过指定目录,创建configmap # 创建一个config目录 [rootk8s-master k8s]# mkdir config[rootk8s-master k8s]# cd config/ [rootk8s-master config]# mkdir test [rootk8s-master config]# cd test [rootk8s-master test…...

python 语音识别
目录 一、语音识别 二、代码实践 2.1 使用vosk三方库 2.2 使用SpeechRecognition 2.3 使用Whisper 一、语音识别 今天识别了别人做的这个app,觉得虽然是个日记app 但是用来学英语也挺好的,能进行语音识别,然后矫正语法,自己说的时候 ,实在不知道怎么说可以先乱说,然…...

一文速览DeepSeek-R1的本地部署——可联网、可实现本地知识库问答:包括671B满血版和各个蒸馏版的部署
前言 自从deepseek R1发布之后「详见《一文速览DeepSeek R1:如何通过纯RL训练大模型的推理能力以比肩甚至超越OpenAI o1(含Kimi K1.5的解读)》」,deepseek便爆火 爆火以后便应了“人红是非多”那句话,不但遭受各种大规模攻击,即便…...

[mmdetection]fast-rcnn模型训练自己的数据集的详细教程
本篇博客是由本人亲自调试成功后的学习笔记。使用了mmdetection项目包进行fast-rcnn模型的训练,数据集是自制图像数据。废话不多说,下面进入训练步骤教程。 注:本人使用linux服务器进行展示,Windows环境大差不差。另外࿰…...

1. Kubernetes组成及常用命令
Pods(k8s最小操作单元)ReplicaSet & Label(k8s副本集和标签)Deployments(声明式配置)Services(服务)k8s常用命令Kubernetes(简称K8s)是一个开源的容器编排系统,用于自动化应用程序的部署、扩展和管理。自2014年发布以来,K8s迅速成为容器编排领域的行业标准,被…...

linux下ollama更换模型路径
Linux下更换Ollama模型下载路径指南 在使用Ollama进行AI模型管理时,有时需要根据实际需求更改模型文件的存储路径。本文将详细介绍如何在Linux系统中更改Ollama模型的下载路径。 一、关闭Ollama服务 在更改模型路径之前,需要先停止Ollama服务。…...