Github 最新的上传代码操作步骤

github取消了密码账号授权登录方式

原有的link到github账户后,还需要进行令牌的授权

首先需要创建一个令牌。可以参照以下链接
创建好令牌之后,以后需要执行
python 复制代码
git remote set-url origin https://[令牌代码]@github.com/xxx/xxx/

完整的操作流程如下:

python 复制代码
##先在github的网页端创建一个仓库

git init ##初始化本地仓库

git branch -m master main   ### 将本地的master 改为 main,与网页端的分支保持统一

git remote add origin  https://github.com/xxx/xxx  ##将本地仓库与远程仓库链接

git remote set-url origin https://[令牌代码]@github.com/xxx/xxx/    ## 授权验证

git pull origin main  ##从远程服务器拉到本地,保持对齐

git add .  # 添加本地文件

git commit -m "first commit"   ##提交

git pull --rebase origin main  ##解决! [rejected]        main -> main (non-fast-forward),避免直接push产生的bug

git push --set-upstream origin main  ##本地文件夹推到远程服务器
相关推荐
haluhalu.3 小时前
prompts.chat:03-core-prompting-principles
prompt·github
阿里嘎多学长16 小时前
2026-07-10 GitHub 热点项目精选
开发语言·程序员·github·代码托管
今夕资源网1 天前
AI声音克隆软件 CosyVoice今夕一键整合包解压即用 阿里巴巴通义实验室开源 github斩获22K星标
人工智能·github·多国语言·声音克隆·零样本语音克隆·感情·ai语音克隆
胡萝卜术1 天前
从聊天模型到本地执行助手:Remote MCP 多工具 Agent 实战
面试·架构·github
慕容引刀1 天前
告别Commit信息纠结:使用Git AI Commit插件实现规范化提交
人工智能·git·github·visual studio code·visual studio
GoGeekBaird2 天前
我开源了 BeeWeave,给 AI Agent 搭一个越用越懂你的知识创作台
后端·github
fthux2 天前
GitZip Pro 源码解析:一个 GitHub 文件/文件夹下载扩展是如何工作的(一)整体架构与扩展入口
人工智能·ai·开源·github·open source
第一程序员2 天前
Rust Agent 子进程执行:Command 之前,先定义输入和超时
python·rust·github
2501_936960362 天前
GitHub初步了解
github
wangruofeng2 天前
11 万 Star 的生成式 AI 入门课,Microsoft 做对了什么
github·aigc·ai编程