一、安装git

1.1 下载

使用PhpStorm上传代码到GitHub,我们需要先下载并安装 git。
git下载地址:https://git-for-windows.github.io/.

1.2 安装

我们以默认选项安装,记住安装目录。
PhpStorm2020 上传 GitHub

1.3 git.exe

安装完成后,我们需要找到git.exe的位置,我们打开git的安装目录,git.exe在Git\bin目录中。

二、新建GitHub项目

2.1 注册并登录

我们进入官网地址: GitHub.,注册自己的GitHub账户并登录,这时我们会进入主页面。

2.2 创建库

在主页面右上角我们点击创建的 “+”,选择“New repository”来创建库。
PhpStorm2020 上传 GitHub

2.3 填写配置信息

我们在创建库的页面中填写配置信息
PhpStorm2020 上传 GitHub

2.4 创建库

点击 Create repository进行创建,我们就会看到创建的仓库。
PhpStorm2020 上传 GitHub

2.5 git地址

现在我们创建好了自己的项目,现在可以clone我们的代码以及上传提交,GitHub会帮助我们托管代码。我们先找到git地址。
PhpStorm2020 上传 GitHub

三、PhpStorm项目

3.1 PhpStorm设置

我们PhpStorm菜单中选择File->Settings
PhpStorm2020 上传 GitHub
在版本控制的git面板中选择我们安装的git.exePhpStorm2020 上传 GitHub
设置后我们点击Test进行测试。
PhpStorm2020 上传 GitHub

3.2 选择GitHub 登录

PhpStorm2020 上传 GitHub
在PHPstorm上将远程仓库文件夹克隆到本地
PhpStorm2020 上传 GitHub
PhpStorm2020 上传 GitHub

四、PhpStorm中git的使用

4.1、上传本地

新建文件并选择commit File,选择的commit File 若不成功,可先选择add 再点击commit File时项目是上传到了我们本地的Git中。
PhpStorm2020 上传 GitHub
我们输入提交的消息并点击Commit。
PhpStorm2020 上传 GitHub

4.2、上传GitHub

现在,我们就可以把代码从本地Git上传到GitHub上面了。我们选择Git->Repository->Push。
PhpStorm2020 上传 GitHub
注意:在push前必须进行commit,否则会显示no commits selected。
PhpStorm2020 上传 GitHub
PhpStorm2020 上传 GitHub
PhpStorm2020 上传 GitHub
点击PUSH就上传了。

相关文章:

  • 2021-05-25
  • 2022-01-15
  • 2021-08-12
  • 2021-05-09
  • 2021-09-17
  • 2021-04-05
  • 2021-04-24
猜你喜欢
  • 2021-06-13
  • 2021-10-02
  • 2021-10-29
  • 2021-05-12
  • 2021-09-15
  • 2021-07-25
  • 2021-06-27
相关资源
相似解决方案