2024-04-10  阅读(325)
原文作者:吴声子夜歌 原文地址: https://blog.csdn.net/cold___play/article/details/103749951

IDEA创建项目并托管到GitHub

步骤

  • 步骤 1 : 创建项目
  • 步骤 2 : 首先在github创建一个仓库
  • 步骤 3 : 制定仓库名称
  • 步骤 4 : 创建成功,得到git地址
  • 步骤 5 : 接着在本地创建一个项目
  • 步骤 6 : 建立本地仓库
  • 步骤 7 : 把项目加入到本地仓库
  • 步骤 8 : 提交项目
  • 步骤 9 : Push Commit
  • 步骤 10 : 查看github

1.创建项目

2.在GitHub上创建一个仓库
首先登陆github.com
然后点击右上角账号左边的加号,点击New repository创建仓库。
Git上仓库就相当于项目的意思

202404102034238861.png

3.指定仓库名称
一般与项目名称相同

202404102034243242.png

4.创建成功,得到git地址
得到github地址:https://github.com/how2j/hiworld

202404102034248963.png

5.接着在本地创建一个项目hiworld,并且新建一个Java类

202404102034252494.png

    public class HiWorld {
        public static void main(String args[]){
            System.out.println("Hi World");
        }
    }

6.建立本地仓库
File->VCS->import into Version Control->Create Git Repository->e:\project\hiworld-OK

202404102034256155.png

7.把项目加入到本地仓库
右键项目->Git->Add

202404102034261966.png

8.提交项目
右键项目->Git->Commit Directory之后弹出如图所示的窗口,在Commit Message 输入 test, 然后点击 Commit And Push

202404102034267357.png

9.Push Commit
这里会询问你要提交的哪里去,点击Define remote,并输入在 创建成功,得到git地址 步骤中的:

    https://github.com/how2j/hiworld

然后点击push

202404102034271548.png

10.查看GitHub
再次刷新github地址:
https://github.com/how2j/hiworld
就可以看到都push上去了

202404102034274769.png

阅读全文
  • 点赞