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 [email protected]

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

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://[email protected]/liujf69/TensorRT-Demo.git

git push -u origin master

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

​​​​设置令牌:

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

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

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

相关推荐
dubochao_xinxi5 小时前
✅ TensorRT Python 安装精简流程(适用于 Ubuntu 20.04+)
开发语言·python·ubuntu
范纹杉想快点毕业5 小时前
以项目的方式学QT开发(一)——超详细讲解(120000多字详细讲解,涵盖qt大量知识)逐步更新!
c语言·数据结构·c++·git·qt·链表·github
yangshuo12816 小时前
风车OVF镜像:解放AI开发限制的Ubuntu精简系统
linux·人工智能·ubuntu
flypig哗啦啦6 小时前
ubuntu服务器版启动卡在start job is running for wait for...to be Configured
linux·运维·ubuntu
qq_653644467 小时前
如何查看打开的 git bash 窗口是否是管理员权限打开
开发语言·windows·git·bash
tonngw8 小时前
【Mac 从 0 到 1 保姆级配置教程 12】- 安装配置万能的编辑器 VSCode 以及常用插件
git·vscode·后端·macos·开源·编辑器·github
子非衣8 小时前
Ubuntu系统挂载磁盘并配置开机自动挂载
linux·运维·ubuntu
ChironW9 小时前
Ubuntu 22.04.5 LTS上部署Docker及相关优化
ubuntu·docker·容器
橄榄熊10 小时前
Git 常用命令详解
git
richer_202010 小时前
双系统重装ubuntu
linux·运维·ubuntu