发布时间:2026-07-21阅读(1)
1.安装好Git,配置环境变量。在系统变量Path中新建一条E:\softwareinstall\Git\Git\bin。
2.打开cmd,cd到要上传的工程目录下。
3.在cmd window中输入
git init
git add .
git commit -m "first commit"//注意输git commit 会报错。
4.去github上创建自己的Repository,点击NewRepository 如下图所示:

创建repository即可。
5.git remote add origin https://自己的仓库url地址
6.git pull origin master
7.git pull --rebase origin master//一开始没有执行这一步会报错,
报错信息如下:! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to https://github.com/hlq1025/-
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: git pull ...) before pushing again.
hint: See the Note about fast-forwards in git push --help for details.
因为github中新建的repository下有readme.md文件,但本地没有这个文件。执行完这个命令后,会看到本地项目下也有了readme.md文件。
8.git push -u origin master。
执行完后,如果没有异常,等待执行完就上传成功了,中间可能会让你输入Username和Password,你只要输入github的账号和密码就行了.
Copyright © 2024 有趣生活 All Rights Reserve吉ICP备19000289号-5 TXT地图HTML地图XML地图