把自己创建在本地的项目提交到github

GitHub 是一个面向开源及私有软件项目的托管平台,因为只支持 Git 作为唯一的版本库格式进行托管,故名 GitHub,越来越多企业使用git管理项目,对于初学者来说,需要掌握git的基本使用,下面简单介绍下,如何将自己本地创建的项目提交到github。

1.进入github官网,链接https://github.com/,登录自己的账号,没有需要注册;
2.登录成功后,点击【newrepository】按钮,创建一个新的仓库,填写Repository name,点击【Create a new repository】;
3.复制链接Http or ssh https://github.com/mc/yunduan.git
4.进入控制台,进入一个空目录下,执行命令:git clone https://github.com/mc/yunduan.git,执行成功后,将当前目录下的.git文件复制,粘贴到你自己所要上传的本地项目下;
5.执行git status,可以看红色的信息,如下:
Mc:InnovationCourse cong.wang$ git status
On branch master

Initial commit

Untracked files:
(use “git add …” to include in what will be committed)

.gitignore
.idea/
app/
build.gradle
gradle.properties
gradle/
gradlew
gradlew.bat
settings.gradle

nothing added to commit but untracked files present (use “git add” to track)
6.执行”git add . “(注意.前后有空格)进入到项目下
Mc:InnovationCourse cong.wang$ git status
On branch master

Initial commit

Changes to be committed:
(use “git rm –cached …” to unstage)

new file:   .gitignore
new file:   .idea/compiler.xml
new file:   .idea/copyright/profiles_settings.xml
new file:   .idea/dictionaries/cong_wang.xml
new file:   .idea/gradle.xml
new file:   .idea/misc.xml
new file:   .idea/modules.xml
new file:   .idea/runConfigurations.xml
new file:   app/.gitignore
...

颜色变绿啦
7.git commit -m “first”(m为message,你每次提交的信息)
8.最后执行git push,如果使用的是http链接,需要手动输入账号密码
至此项目成功上传到github上啦~

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值