把本地的项目代码初始化到git仓库

复制代码
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
相关推荐
AIMath~16 小时前
向github中上传文件过大超过50M怎么办
网络·git·github
AIMath~20 小时前
如何将一个新的文件夹使用git 工具提交到github新仓库中
git·github
满天星830357720 小时前
【Git】原理及使用(二) (版本回退)
linux·git
愿天垂怜21 小时前
【C++脚手架】ffmpeg 库的介绍与使用
linux·服务器·开发语言·c++·ide·git·ffmpeg
月夜的风吹雨21 小时前
Linux 基础开发工具详解:从 yum 到 gdb 实战指南
linux·git·ubuntu·centos·vim
好运yoo21 小时前
git cherry-pick
git
不是光头 强1 天前
Obsidian Git 插件安装与配置完全指南
git
.千余1 天前
【C++】C++核心语法:函数重载与缺省参数原理与避坑
c语言·开发语言·c++·经验分享·笔记·git·学习
meowrain1 天前
Git HTTPS Token 凭据配置指南
git·网络协议·https
Ws_1 天前
Git + Gerrit 第二课:diff、暂存区与撤销修改
git