The project has been submitted to GitHub

1. Purpose:

  The project has been submitted to GitHub

 

2. Preparation 

  2.1 This tutorial builds have a preliminary understanding on git

  We need to work before this tutorial 2.2

    a. be familiar with some basic commands and principles of git.

    b. GitHub account has been registered.

    c. the local environment has been installed git environment, you can open and use git shell.

    d. local has registered .ssh keys verified on GitHub

 

3. Methods

  3.1 Entering gitshell

  3.2 project into the directory specified for the git directory command to initialize

 

  3.3 Creating and local projects on GitHub branch of the same name <of course, provided you already have a GitHub account>

  

  

  3.4 After you create a new repository on GitHub success, use the command associated with the local library and remote GitHub repository, as follows:

  $ git remote add origin [email protected]:Monkey-mi/learngit.git

 

  3.5 will add local files to the local cache and committed to the local library branch, the following commands

    the Add git.       // submit all the files to the local cache; Behind the representatives of all documents; 
    git the commit -m "All the commit File" // submit all files to the local library

 

   3.6 submit local to remote libraries

  $ Git push -u origin master // add first submission command parameter - U associated with the local library and make sure the remote repository 
  $ git push origin master // not the first time you use this command to submit

 

 

   3.7 Review New repository page on GitHub, the local project has been submitted up

  

 

4. Summary

  In addition to the new purpose as a circumstance outside the local branch, after the basic understanding of the operation, the project has been submitted to achieve is not difficult.

 

 5. sincere recommendation

  4.1 史上最好的git教程:http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000

  4.2 GitHub官网:https://github.com/

 

  将已有的项目提交到GitHub

 

2.准备工作 

  2.1 此教程建立在对git有初步的理解上

  2.2 此教程之前需准备工作

    a.熟悉git的一些基本命令和原理.

    b.已注册有GitHub账号.

    c.本地环境已安装git环境,可以打开且使用git shell.

    d.本地已在GitHub上注册了.ssh 秘钥验证

 

3.方法

  3.1 进入gitshell

  3.2 进入到项目指定的目录下,适用git命令初始化该目录

 

  3.3 在GitHub上创建和本地项目的同名分支<当然前提是你已拥有了一个GitHub账号>

  

  

  3.4 在GitHub创建新repository成功之后,使用命令关联本地库和GitHub远程库,如下:

  $ git remote add origin [email protected]:Monkey-mi/learngit.git

 

  3.5 将本地文件添加到本地缓存库和提交到本地分支,如下命令

    git add .      //将所有的本地文件提交到缓存中;后面的 . 代表所有文件;
    git commit -m "commit all file"  //将所有文件提交到本地库中

 

   3.6 提交本地到远程库

  $ git push -u origin master //第一次提交 添加命令参数 -u 确保关联本地库和远程库
  $ git push origin master //非第一次提交使用此命令即可

 

 

   3.7 查看GitHub上新建repository页面,本地的项目已经提交上去

  

 

4.总结

  作为除新建本地分支之外的一种情况,在基本操作了解之后,实现提交已有项目的目的并不困难。

 

 5.至诚推荐

  4.1 史上最好的git教程:http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000

  4.2 GitHub官网:https://github.com/

 

Guess you like

Origin www.cnblogs.com/Free-Thinker/p/10935628.html