把本地的项目代码初始化到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
相关推荐
rockmelodies1 小时前
Git冲突解决实用指南
git·git冲突
bj_zhb1 小时前
Git 回退到某个 commit
git·github
凯子坚持 c1 小时前
Git分支实战指南:如何优雅地管理版本、修复Bug并解决合并冲突
git·bug
openinstall全渠道统计2 小时前
开发者指南:广告投放系统搭建与前后端数据打通全流程
windows·git·oracle·eclipse·sqlite·github
yunianshu2 小时前
在 DevEco Studio 中查看 Git 本地更改 (Local Changes) 指南
git
脾气有点小暴2 小时前
git commit 的提交如何撤销
git
winner88812 小时前
Git撤销修改:git restore . 与 git reset --hard 万字详解
git·git reset·git restore .
我的offer在哪里3 小时前
SourceTree 全方位使用教程
git
Irene199113 小时前
查看是否已安装 Git 的方法
git
my_power52013 小时前
检出git项目到android studio该如何配置
android·git·android studio