GitHub getting started

Source: Internet
Author: User

For GitHub introduction, see Baidu encyclopedia.


1. register an account at https://github.com.

2. After the registration is successful, create a repository (repository ).

The new page is as follows:

Enter the project name. All other items are default.

After the creation is successful, the browser jumps to a new page, as shown below:

Remember to use the address marked in red.

The following prompt shows you how to submit a project to the repository you just created through the command line. When you create a repository, a unique address is generated,

In this example: https://github.com/itmyhome2013/mygithub.git


3. download and install the client msysgit

: Http://msysgit.github.io/installation after download, continue to the next step

After installing msysgit, right-click and choose "Git init here" in the local repository to add a. Git folder,

This indicates that the local git is successfully created. Right-click git Bash to enter the GIT command line, and open the following git bash interface:


4. Create a version Library
What is a version library? A version library, also known as a repository, has the English name repository. You can simply think of it as a directory where all files can be managed by git,

The modification and deletion of each file can be tracked by git, so that history can be tracked at any time, or "restored" at a certain time in the future ".

Therefore, creating a version library is very simple.


Step 1: first, select an appropriate place to create an empty directory (disk D in this example ):

$ cd d:$ mkdir mygithub$ cd mygithub$ pwd/d/mygithub

CD is to enter a directory, mkdir indicates new.

The PWD command is used to display the current directory. My repository is located in/D/mygithub


Step 2: Use the GIT init command to change this directory to a git-managed repository.

$ git initInitialized empty Git repository in d:/mygithub/.git/
In an instant, git builds the repository and tells you that it is an empty repository (empty git repository). In the mygithub directory, we have an additional. Git directory,

This directory is used by git to track and manage version libraries. Do not manually modify the files in this directory. Otherwise, the GIT repository will be damaged.


5. Add the file to the version Library

Create a new readme.txt file under the/D/mygithub directory with the content Hello GitHub


Step 1: Run git add to tell git to add the file to the repository:

$ git add README.txt
If the preceding command is not displayed, the Unix philosophy is "no message is good news", indicating that the addition is successful.

If you want to add all files, use git Add. "." To add all files in the current directory.


Step 2: Run git commit to tell git to submit the file to the repository:

$ git commit -m "hello github"[master (root-commit) 0db7ba5]1 file changed, 1 insertion(+)create mode 100644 README.txt


Step 3: Enter the remote address

$ git remote add origin https://github.com/itmyhome2013/mygithub.git
Https: the unique address generated when the repository is created.


Step 4: Upload to GitHub:

$ git push -u origin master
Then, you will be prompted to enter the user name and password:
Username for ‘https://github.com‘: yourUsernamePassword for ‘https://[email protected]‘: yourPassword
Note: The password is not displayed on the console.

After the submission is successful, you can go to GitHub to view your project.




Attach all command operations:



Summary:
1. Register a GitHub account

2. Create a repository warehouse

3. Install the msysgit Client

4. Create a version Library

1) create a directory

2) run the GIT init command to change the directory to a git-managed repository.

5. add files to the version Library

1) Use the GIT add command. Note that you can use it multiple times to add multiple files.

2) use the command git commit to submit to the repository

3) run the GIT Remote Command to enter the remote address.

4) use the GIT push command to upload data to GitHub.


Itmyhome

Source: http://blog.csdn.net/itmyhome1990/article/details/39579099



GitHub getting started

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.