github上传_Windows下如何如何将项目上传至GitHub?

## 安装git客户端 进入官网,点击右侧下载windows版本的软件包

8dc8af6359c00be81c0b6fe692949275.png

· ·

c4bf3dbf4621526255f622eb55118fdc.png

· ·

8eda790f211ce0d6821cbbf7e7441ede.png

· 如果下载慢的话,给一个传送门,可以快速下载:

970fe12515808444107afd7cbd62b103.png

· · ·

7a5b16d20ee41aa1ac524f43a9ee9afd.png

· 双击安装

1b7323391ff00dbc5c9f18dc83dbde68.png

一直点击下一步就可,安装位置可以自己选择一下

Github创建仓库

0727f6f8b9f68d11327b32e763df832c.png

填写项目名称以及base 描述

ea06456817561173ce4a5eafd2db3a41.png

· 在git安装目录双击启动git bash

8a38f6e2e828b62e0b4ec521cfcf4639.png

·

f91d9fca672b11c5e95e94c1c30ba649.png

· 使用cd 命令 转移到预上传的项目的目录下

f19a40df70a3e86ae30c89dcc18fab35.png

· 输入pwd查看当前文件夹位置

66b3e696a0077de72d58d0bcd552451b.png

使用如下命令创建git仓库

先设置email和username

git config --global user.email 'your email'
git config --global user.name 'your name'

创建本地仓库并与github仓库关联

git init  #将该文件夹变成Git可以管理的仓库
git add .  #将所有文件提交到暂存区
git commit -m '说明'   #提交到版本库中
git remote add origin https://github.com/ikm565/PyQt-QQ.git
#将本地仓库与GitHub网站的仓库进行关联。

github仓库链接在这:

6cc62c3ba042225d6ccfcc32ddc5207a.png

· · · 在将本地仓库与GitHub网站上的仓库进行关联后,便可进行推送了,但是在进行推送时,GitHub网站上的仓库并非是空的,因此需要将两者进行合并才行。

git pull --rebase origin master #合并
git push -u origin master  #推送

8330b92ca20ef83c4197a42a143e3e1d.png

再次查看仓库,已经有了项目:

e14fc79a849e751651c806d839b1826f.png

如果更新了项目,通过以下命令进行维护:

git add -A               #将文件的修改上传到暂存区
git commit -m '说明'      #提交到本地仓库
git push origin master   #推送到GitHub仓库

附上我的构建过程:

pwd

20626@LAPTOP-T9NGUSPL MINGW64 /d/workspace/python Workspace/py-communicate-final (master)
$ git remote add origin  https://github.com/ikm565/PyQt-QQ.git
fatal: remote origin already exists.

20626@LAPTOP-T9NGUSPL MINGW64 /d/workspace/python Workspace/py-communicate-final (master)
$ git remote add origin https://github.com/ikm565/PyQt-QQ.git
fatal: remote origin already exists.

20626@LAPTOP-T9NGUSPL MINGW64 /d/workspace/python Workspace/py-communicate-final (master)
$ git pull --rebase origin master
fatal: 'pwd' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

20626@LAPTOP-T9NGUSPL MINGW64 /d/workspace/python Workspace/py-communicate-final (master)
$ git init
Reinitialized existing Git repository in D:/workspace/python Workspace/py-communicate-final/.git/

20626@LAPTOP-T9NGUSPL MINGW64 /d/workspace/python Workspace/py-communicate-final (master)
$ git add .

20626@LAPTOP-T9NGUSPL MINGW64 /d/workspace/python Workspace/py-communicate-final (master)
$ git commit -m 'first git'
On branch master
nothing to commit, working tree clean

20626@LAPTOP-T9NGUSPL MINGW64 /d/workspace/python Workspace/py-communicate-final (master)
$ git init
Reinitialized existing Git repository in D:/workspace/python Workspace/py-communicate-final/.git/

20626@LAPTOP-T9NGUSPL MINGW64 /d/workspace/python Workspace/py-communicate-final (master)
$ git init
Initialized empty Git repository in D:/workspace/python Workspace/py-communicate-final/.git/

20626@LAPTOP-T9NGUSPL MINGW64 /d/workspace/python Workspace/py-communicate-final (master)
$ git add .
warning: LF will be replaced by CRLF in .gitignore.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in .idea/inspectionProfiles/profiles_settings.xml.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in Dialog_add.ui.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in frist.qrc.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in group.ui.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in login.ui.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in main_interface.ui.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in single_person.ui.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in web绔?.idea/dbnavigator.xml.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in web绔?.idea/flasky.iml.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in web绔?.idea/misc.xml.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in web绔?.idea/modules.xml.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in web绔?.idea/vcs.xml.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in web绔?.idea/workspace.xml.
The file will have its original line endings in your working directory

20626@LAPTOP-T9NGUSPL MINGW64 /d/workspace/python Workspace/py-communicate-final (master)
$ git commit -m 'first git'
[master (root-commit) 21e64c4] first git
 83 files changed, 5155 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 .idea/inspectionProfiles/profiles_settings.xml
 create mode 100644 .idea/misc.xml
 create mode 100644 .idea/modules.xml
 create mode 100644 .idea/pyqt5-QQ.iml
 create mode 100644 .idea/workspace.xml
 create mode 100644 Dialog_add.py
 create mode 100644 Dialog_add.ui
 create mode 100644 frist.qrc
 create mode 100644 group.py
 create mode 100644 group.ui
 create mode 100644 image/Icon_head.jpeg
 create mode 100644 image/Icon_head.png
 create mode 100644 image/Icon_logger.png
 create mode 100644 image/Icon_user.png
 create mode 100644 image/QQ1.jpg
 create mode 100644 image/QQicon.ico
 create mode 100644 image/contact_green.png
 create mode 100644 image/icon.jpg
 create mode 100644 image/myicon_1.jpeg
 create mode 100644 image/myicon_1.png
 create mode 100644 image/partjob.png
 create mode 100644 image/qq.jpeg
 create mode 100644 image/wechat.png
 create mode 100644 login.py
 create mode 100644 login.ui
 create mode 100644 main_interface.py
 create mode 100644 main_interface.ui
 create mode 100644 res/0.jpg
 create mode 100644 res/1.jpg
 create mode 100644 res/10.jpg
 create mode 100644 res/11.jpg
 create mode 100644 res/12.jpg
 create mode 100644 res/13.jpg
 create mode 100644 res/14.jpg
 create mode 100644 res/15.jpg
 create mode 100644 res/16.jpg
 create mode 100644 res/16.png
 create mode 100644 res/17.jpg
 create mode 100644 res/18.jpg
 create mode 100644 res/19.jpg
 create mode 100644 res/2.jpg
 create mode 100644 res/20.jpg
 create mode 100644 res/21.jpg
 create mode 100644 res/22.jpg
 create mode 100644 res/23.jpg
 create mode 100644 res/24.jpg
 create mode 100644 res/25.jpg
 create mode 100644 res/3.jpg
 create mode 100644 res/4.jpg
 create mode 100644 res/5.jpg
 create mode 100644 res/6.jpg
 create mode 100644 res/7.jpg
 create mode 100644 res/8.jpg
 create mode 100644 res/9.jpg
 create mode 100644 res/default.ico
 create mode 100644 res/log.ico
 create mode 100644 server.py
 create mode 100644 server_downloads/0.jpg
 create mode 100644 server_downloads/1.jpg
 create mode 100644 server_downloads/13.jpg
 create mode 100644 server_downloads/4.jpg
 create mode 100644 server_downloads/6.jpg
 create mode 100644 server_downloads/7.jpg
 create mode 100644 single_person.py
 create mode 100644 single_person.ui
 create mode 100644 test/test.py
 create mode 100644 test/test2.py
 create mode 100644 "web347253257/.idea/dbnavigator.xml"
 create mode 100644 "web347253257/.idea/flasky.iml"
 create mode 100644 "web347253257/.idea/misc.xml"
 create mode 100644 "web347253257/.idea/modules.xml"
 create mode 100644 "web347253257/.idea/vcs.xml"
 create mode 100644 "web347253257/.idea/workspace.xml"
 create mode 100644 "web347253257/__init__.py"
 create mode 100644 "web347253257/config.py"
 create mode 100644 "web347253257/register/__init__.py"
 create mode 100644 "web347253257/register/main_app.py"
 create mode 100644 "web347253257/register/templates/change.html"
 create mode 100644 "web347253257/register/templates/change_after.html"
 create mode 100644 "web347253257/register/templates/change_sign.html"
 create mode 100644 "web347253257/register/templates/loginin.html"
 create mode 100644 "web347253257/register/templates/regist.html"

20626@LAPTOP-T9NGUSPL MINGW64 /d/workspace/python Workspace/py-communicate-final (master)
$ git remote add origin https://github.com/ikm565/PyQt-QQ.git

20626@LAPTOP-T9NGUSPL MINGW64 /d/workspace/python Workspace/py-communicate-final (master)
$ git pull --rebase origin master
fatal: couldn't find remote ref master

20626@LAPTOP-T9NGUSPL MINGW64 /d/workspace/python Workspace/py-communicate-final (master)
$ git push -u origin master
Enumerating objects: 88, done.
Counting objects: 100% (88/88), done.
Delta compression using up to 8 threads
Compressing objects: 100% (85/85), done.
Writing objects: 100% (88/88), 437.98 KiB | 13.27 MiB/s, done.
Total 88 (delta 14), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (14/14), done.
To https://github.com/ikm565/PyQt-QQ.git
 * [new branch]      master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.

20626@LAPTOP-T9NGUSPL MINGW64 /d/workspace/python Workspace/py-communicate-final (master)
$ git ass -A
git: 'ass' is not a git command. See 'git --help'.

The most similar commands are
        add
        askpass
        lfs
        stash

20626@LAPTOP-T9NGUSPL MINGW64 /d/workspace/python Workspace/py-communicate-final (master)
$ git add -A

20626@LAPTOP-T9NGUSPL MINGW64 /d/workspace/python Workspace/py-communicate-final (master)
$ git commit -m 'first git'
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

20626@LAPTOP-T9NGUSPL MINGW64 /d/workspace/python Workspace/py-communicate-final (master)
$ ^C

20626@LAPTOP-T9NGUSPL MINGW64 /d/workspace/python Workspace/py-communicate-final (master)
$
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 要将本地项目上传GitHub 上,你需要完成以下步骤: 1. 在 GitHub 上创建一个新的仓库,或者打开一个已有的仓库。 2. 打开命令行终端(如 Git Bash),进入本地项目的根目录。 3. 初始化 Git 仓库:执行命令 `git init`。 4. 将文件添加到 Git 仓库中:执行命令 `git add .`(注意“.”是当前目录的意思,这里表示将当前目录下的所有文件添加到 Git 仓库中)。 5. 提交文件到 Git 仓库:执行命令 `git commit -m "提交说明"`,其中“提交说明”是对本次提交的描述。 6. 关联本地 Git 仓库和 GitHub 远程仓库:执行命令 `git remote add origin 仓库地址`,其中“仓库地址”是你在 GitHub 上创建的仓库的地址。 7. 推送代码到 GitHub 远程仓库:执行命令 `git push -u origin master`,其中“master”是你要推送的分支名。 完成以上步骤后,你的本地项目就会被上传GitHub 上了。 ### 回答2: 要将本地项目上传GitHub,首先需要在GitHub上创建一个新的仓库。在仓库页面中,可以选择使用HTTPS或者SSH的方式克隆仓库到本地。接下来,使用Git命令行或者Git GUI工具,将本地项目关联到GitHub仓库。 1. 使用Git Bash或者终端命令进入本地项目的根目录。 2. 运行以下命令来初始化本地仓库: git init 3. 将项目中的文件添加到本地仓库: git add . 这个命令将会把项目文件中的所有文件添加到本地暂存区。 4. 确认要提交的修改: git commit –m "Initial commit" 在引号里填写一个合适的提交信息来描述这个提交。 5. 关联本地仓库和远程GitHub仓库: git remote add origin [GitHub仓库地址] 将GitHub仓库的地址替换成你自己创建的仓库地址。 6. 将本地仓库的提交推送到远程仓库: git push -u origin master 这个命令将会将本地的master分支的所有提交推送到远程的origin仓库。 推送完成后,就可以通过GitHub网站检查你的仓库是否已经包含了本地项目的文件。 如果在上传过程中遇到问题,可以通过查阅Git文档或者GitHub帮助来获得更多细节和指导。 ### 回答3: 要将本地项目上传GitHub,你需要按照以下步骤进行操作: 1. 在GitHub上创建一个新的存储库(repository),命名为你想要的项目名称,并确保选择公共或私有设置。 2. 在本地项目的文件夹中打开Git Bash(如果你使用的是Windows系统)或终端(如果你使用的是Mac或Linux系统)。 3. 使用git init命令将此文件夹初始化为Git存储库。这将创建一个名为“.git”的隐藏文件夹。 4. 使用git add命令将项目的文件添加到Git存储库中。例如,git add .命令将添加所有文件。 5. 使用git commit命令提交文件的更改。例如,git commit -m "Initial commit"将提交并添加一个简短的描述。 6. 连接本地存储库与GitHub存储库,使用git remote add命令。例如,git remote add origin https://github.com/你的用户名/你的存储库.git。 7. 使用git push命令将本地项目上传GitHub。例如,git push -u origin master将上传本地项目GitHub的主分支。 8. 输入GitHub的用户名和密码进行身份验证。 9. 等待上传完成后,刷新你的GitHub存储库页面,就能看到你的本地项目已经成功上传GitHub上了。 这些就是将本地项目上传GitHub的基本步骤。通过利用版本控制的好处,你可以轻松地与他人合作,并确保你的项目历史记录的可追踪性。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值