如何将本地的项目上传到git

如何将本地的项目上传到git

1 进入项目文件夹,把目录变为git仓库

git init

2 把文件添加到版本库中

git add .

3 把版本提交到版本库

git commit -m 'first commit'

4 关联远程库

git remote add origin 你的远程库地址

5 获取远程库与本地同步合并(如果远程库不为空必须做这一步,否则后面的提交会失败)

git pull origin master

git配置过程中fatal:拒绝合并无关的历史

git branch --set-upstream-to=origin/master master
git pull --allow-unrelated-histories

6 提交

git push origin -u master
原文地址:https://www.cnblogs.com/jiqing9006/p/9959718.html