GitHub实战系列~2.把本地项目提交到github中 2015-12-10

时间:2022-05-07
本文章向大家介绍GitHub实战系列~2.把本地项目提交到github中 2015-12-10,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

实例:

1.上面步骤和昨天一样,先在github里面新建一个项目,然后clone一份到本地

2.把本地文件拖到git项目文件夹里面(后面讲怎么过滤文件)

3.打开git bash 进入项目文件夹,添加全部(*) 提交

DNT@DESKTOP-PTACRF6 MINGW64 ~
$ cd Windows10/

DNT@DESKTOP-PTACRF6 MINGW64 ~/Windows10 (master)
$ ls

DNT@DESKTOP-PTACRF6 MINGW64 ~/Windows10 (master)
$ ls
00.HelloWorld/   02.XAMLBaseDKill/  04.MyProgram/    AppTest/   Win10开发.sln  Win10开发.v12.suo
01.MyCommonAPP/  03.MyDivApp/       05.AllControls/  packages/  Win10开发.suo

DNT@DESKTOP-PTACRF6 MINGW64 ~/Windows10 (master)
$ git add *

DNT@DESKTOP-PTACRF6 MINGW64 ~/Windows10 (master)
$ git commit -m "逆天WP-Win10开发笔记源码(学习ing)"

4.push到github里面

DNT@DESKTOP-PTACRF6 MINGW64 ~/Windows10 (master)
$ git push

———————记录2—————————————— DNT_PC@DNT_PC-PC MINGW32 /d/gitworks/test (master) $ git commit -m "直接添加本地文件库到github" [master f33514f] 直接添加本地文件库到github 2 files changed, 223 insertions(+) create mode 100644 "345221275344273244.txt" create mode 100644 "350256260345275225.txt"

DNT_PC@DNT_PC-PC MINGW32 /d/gitworks/test (master) $ git push warning: push.default is unset; its implicit value has changed in Git 2.0 from 'matching' to 'simple'. To squelch this message and maintain the traditional behavior, use:

git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

git config --global push.default simple

When push.default is set to 'matching', git will push local branches to the remote branches that already exist with the same name.

Since Git 2.0, Git defaults to the more conservative 'simple' behavior, which only pushes the current branch to the corresponding remote branch that 'git pull' uses to update the current branch.

See 'git help config' and search for 'push.default' for further information. (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode 'current' instead of 'simple' if you sometimes use older versions of Git)

Counting objects: 4, done. Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 3.91 KiB | 0 bytes/s, done. Total 4 (delta 0), reused 0 (delta 0) To git@github.com:dunitian/test.git 4e69105..f33514f master -> master ————————————————————————————————————————