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;

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

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

相关推荐
lbb 小魔仙15 分钟前
Ubuntu 22.04 + Windows 本地部署 AI 大模型完全指南:Ollama + Python 调用实战(附国内加速配置)
人工智能·windows·python·ubuntu
HoneyMoose1 小时前
把 SVN 仓库转换为 Git 需要的 2 个命令
git·svn
历程里程碑11 小时前
4 Git远程协作:从零开始,玩转仓库关联与代码同步(带实操代码讲解)
大数据·c++·git·elasticsearch·搜索引擎·gitee·github
金銀銅鐵13 小时前
[git] 浅解 git reset 命令
git·后端
zhangfeng113314 小时前
部署到服务器上 宝塔系统 使用宝塔在线编辑器 FTP 批量上传 Git 部署 打包上传 codebudyy 编程程序开发
服务器·git·编辑器
学习是种信仰15 小时前
Git工作流
git·深度学习
萧行之15 小时前
Ubuntu+Windows双系统:解决GRUB不显示Windows启动项、一闪而过问题
linux·windows·ubuntu
yuanyuan2o216 小时前
Git merge 的几种不同模式
git·github
视觉小萌新17 小时前
关于Vscode配置企业Git
git
zh_xuan17 小时前
使用命令行把安装包上传到github
c++·git·libcurl·c++工程打包