Git笔记--Ubuntu上传本地项目到github

目录

1--基本配置

2--本地上传


1--基本配置

① 创建ssh-key

bash 复制代码
cd ~/.ssh

ssh-keygen -t rsa -C "邮箱地址"

② 查看并关联ssh-key

bash 复制代码
gedit id_rsa.pub

复制内容,在 GitHub 中依次点击 Settings -> SSH and GPG keys -> New SSH key,将 id_rsa.pub 文件中的字符串复制进去;

③ 检查关联情况

bash 复制代码
ssh -T git@github.com

输出欢迎信息即关联认证成功!

2--本地上传

bash 复制代码
git init

git add .

git status

git commit -m  "first commit"

git remote add https://github.com/liujf69/TensorRT-Demo.git

# 用于设置令牌
# 格式: git remote set-url origin https://<令牌名称>@github.com/<用户名><仓库名>.git
git remote set-url origin  https://ubuntu20.04@github.com/liujf69/TensorRT-Demo.git

git push -u origin master

# 输入令牌对应的密码即可!
# 密码在生成令牌时自动生成!

​​​​设置令牌:

Settings -> Developer Settings -> Personal access tokens -> Tokens (classic) -> Generate new token;

默认勾选所有权限即可,同时设置令牌的有效时间;

生成的密码注意保存,其刷新即消失;

相关推荐
IT摆渡者14 小时前
ubuntu系统网络问题
linux·运维·ubuntu
.Hypocritical.15 小时前
Git 全套实操|配置 /.gitignore/ 分支合并 / 冲突解决 /git stash 完整教程
git
来日方长。。。。long16 小时前
Hermes Agent橙皮书共读|第三篇:保姆级实战部署|本地/VPS从零搭建Hermes
ide·git·hermes
其实防守也摸鱼16 小时前
VS Code Git 工作树:解锁多分支并行开发新体验
数据库·git·安全·oracle·架构·自动化
ERD Online17 小时前
我们怎么设计 good first issue:让第一个 PR 两小时内合入
数据库·git·后端·开源·issue
海兰18 小时前
ffmpeg-wasm 完整安装指南(Ubuntu 24.04)
ubuntu·ffmpeg·wasm
海兰18 小时前
云原生持续交付平台 Zadig 在 Ubuntu 24.04 上的部署及使用指南
linux·ubuntu·云原生
Anesthesia丶20 小时前
PromoxVE安装笔记
笔记·ubuntu·server·promox
Python私教1 天前
Codex 自动写 Commit 够安全吗?一套证据化 Git 提交流程
人工智能·git·后端
果果燕1 天前
实习笔记(一):NFS、Samba、VNC、Git、CMake、systemd、内核、交叉编译
linux·arm开发·c++·笔记·git