cd /path/to/your/project
# 在当前目录创建新的仓库
git init
# 添加当前目录下的所有文件到暂存区
git add .
# 添加commit message
git commit -m "Initial commit"
# 关联远程仓库
git remote add origin https://github.com/username/repository.git
# 更改默认仓库(看是否需要)
git remote set-url origin https://github.com/username/new-repository.git
# 推送到远程仓库
git push
# 查看远程仓库地址
git remote -v
把本地的项目代码初始化到git仓库
斜月三2024-07-31 22:08
相关推荐
南_山无梅落1 小时前
Git 结合 Gitee 使用教程:从入门到实战这就是佬们吗1 小时前
Windows 的 CMD 网络环境:解决终端无法联网与更新的终极指南醇氧9 小时前
【git】WARNING: connection is not using a post-quantum key exchange algorithm.一只程序熊10 小时前
Git不常用操作记录小龙11 小时前
【Git 报错解决】 远程仓库 origin 已存在(`remote origin already exists`)BORN(^-^)19 小时前
Git 操作概要bigHead-1 天前
Git合并操作详解:安全高效地合并远程分支C_心欲无痕1 天前
ts - 交叉类型秋饼1 天前
【K8S测试程序--git地址】小龙1 天前
【Git 报错解决】本地无有效提交无法推送(`src refspec main does not match any`)