How to create a new project in github using the command line
http://www.jianshu.com/p/df7ce9f3a5cb (transfer)
Foreword: The basic knowledge of new github
accounts and those who have already added their own computers to the default readers , let's pay attention to how to create a new project. This article refers to this articlegit
SSH Key
github
github
New projects are divided into 2 situations:
1. The code starts from scratch.
2. The project code already exists locally, but I just want to put github
it on open source or store it.
However, in either case, you must first github
create a new project repository. After logging github
in, find Repositories
the tab in the figure below, and then click the red box new
to create a new project repository.
The interface for creating a new project repository is as follows:
Then enter the name of your project, the description of the project from top to bottom, and choose whether the project is public (Public) or as a private project (Private).
Initialize this repository with a README
This option is asking if you want to help you initialize a project based on the project name and description you entered (generate a README md file)
The next step is to ask if you want to add the project's ignore file (.gitigore) and whether you want to add a license to your project.
The above can be filled in and selected according to your own actual needs, and then click the green button to create a project warehouse.
It will then jump to a home page of your project.
code from scratch
You can create a blank folder locally, then clone the project you just created (ps: clone url can be found at the bottom right of the project home page) locally, then add the code and upload it.
mkdir emptyFolder
cd emptyFodler
git clone https://github.com/youraccount/yourproject.git
Then the rest is the matter of git add
and .git push
Code already exists locally
-
Execute the command first in your project file directory to
git init
make it agit
repository. -
To add all files in the project to the local repository, use the following command:
git add . //注意还有一个小圆点 git commit -m "some message for this project."
-
Then
github
pull the project ongit pull https://github.com/youraccount/yourproject.git
-
Add a remote repository named origin for the repository.
git remote add origin https://github.com/youraccount/yourproject.git
-
Execute the push command to complete the initialization of the GitHub repository. Pay attention to the -u parameter in the command line, after the push is successful, the tracking of the local branch and the remote repository branch is automatically established
git push -u origin master
PS: If the links and content involved in the article are infringing, please let me know, and I will delete them. If there are any mistakes or omissions in this article, please correct me. thanks. :P