markdown 创建一个新的Git(Hub)项目

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 创建一个新的Git(Hub)项目相关的知识,希望对你有一定的参考价值。

## Creating a New Git(Hub) Project

These are the steps I follow for:
- Creating a new project locally on my Mac and on Github
- Locally initializing the project with `npm` and `git`
- Linking the local and GitHub projects
- Performing the initial commit
- Pushing to Github

Assumptions:
- Must have a [GitHub](https://github.com) Account
- Must have [git](https://git-scm.com) installed

1. Create a new GitHub repository by going to https://github.com/new

    1. Provide a Repository Name and Description
        - _Repository Name_ should have no spaces and will be referenced below as `<project name>`
    2. Make it Private
    3. Do not check Initialize
    4. Do not Add a .gitignore
    5. Do not Add a license
    6. Click on Create Repository

    <a href="https://content.screencast.com/users/jmcombs/folders/Snagit/media/384bdc1a-b262-4173-89c7-7131ae6b4045/2019-04-07_11-56-10.png"><img class="embeddedObject" src="https://content.screencast.com/users/jmcombs/folders/Snagit/media/384bdc1a-b262-4173-89c7-7131ae6b4045/2019-04-07_11-56-10.png" width="719" height="606" border="0" /></a>

2. Open Terminal, create and change directory to the Project folder 

    `mkdir <project name>`
    
    `cd <project name>`

3. Initialize the Project with NPM

    **NOTE:** 
    * I prefer to make sure `package name` matches `<project name>` and `description` matches Description for GitHub Repository
    * For license I am using `UNLICENSED` for projects that are not open source
    * Do not forget to specify you app's entry pont. I use `app.js` for mine.
  
    ```
    \!h JMCOMBSMBP:my-project jmcombs$  npm init
    This utility will walk you through creating a package.json file.
    It only covers the most common items, and tries to guess sensible defaults.
    
    See `npm help json` for definitive documentation on these fields
    and exactly what they do.
    
    Use `npm install <pkg>` afterwards to install a package and
    save it as a dependency in the package.json file.
    
    Press ^C at any time to quit.
    package name: (my-project) 
    version: (1.0.0) 
    description: My Project's Description
    \!h entry point: (index.js) app.js
    test command: 
    git repository: http://github.com/jmcombs/my-project
    keywords: 
    author: Jeremy Combs <jmcombs@me.com> (http://wwjcdo.com)
    \!h license: (ISC) UNLICENSED
    About to write to /Users/jmcombs/Documents/Projects/my-project/package.json:
    
    {
      "name": "my-project",
      "version": "1.0.0",
      "description": "",
      "main": "app.js",
      "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1"
      },
      "repository": {
        "type": "git",
        "url": "git+ssh://git@github.com/jmcombs/my-project.git"
      },
      "author": "Jeremy Combs <jmcombs@me.com> (http://wwjcdo.com)",
      "license": "UNLICENSED",
      "bugs": {
        "url": "https://github.com/jmcombs/my-project/issues"
      },
      "homepage": "https://github.com/jmcombs/my-projects#readme"
    }
    ```

4. Initialize the Project with `git`

    `git init`

5. Add all Project files to `git`

    `git add .`

6. Perform initial commit

    `git commit -m "Initial commit"`

7. Link local `git` repository with GitHub repository

    `git remote add origin https://github.com/jmcombs/my-project.git`

8. Perform push to GitHub

    `git push -u origin master`

Congratulations, `<project name>` is now created and synchronized with `git`.

以上是关于markdown 创建一个新的Git(Hub)项目的主要内容,如果未能解决你的问题,请参考以下文章

markdown git创建一个新的存储库

Eclipse 4.5.2 Mars 中配置Git 并提交项目到Git hub

markdown 使用git push为项目部署创建一个裸的远程git存储库

Unity Hub 自定义一个创建新项目模板(Template)

利用Git hub创建博客

个人 git-hub使用方法