Git/Github usage notes

Source: Internet
Author: User

Git/Github usage notes

Because it was previously based on an open-source project on Github, we put it on Github. Although we have no experience in using it, we can still solve it with a grinder.

The following are the specific steps for using Git/Github. You should take a note by yourself.

1. Download and install git on the desktop.

Windows to http://code.google.com/p/msysgit/

It is better to allow shell embedded git commands during installation, which is relatively convenient.

OSX can install command line tools in xcode, or brew install git

2. Initial git settings

Git config -- global user. name "Your Real Name"

Git config -- global user. email you@email.address

3. Create a warehouse

Find your project directory in git bash. (Or right-click the git bash here in shell)

Git init

In this way, there will be a. git hidden directory (similar to. svn) under your project directory ).

4. initialize the project

Git add.

Pay attention to the later ".". This is the case of adding all files. If you want to, you can also add specific files, such as git add readme.txt.

Then we can make our first commit to the warehouse.

Git commit-m'first commit'

-The m parameter and the subsequent strings are added.

5. Register a github account

The following are the operations related to github.

First go to http://github.com/registration account number. After registration, you can see this interface. Select the first item to create a project.

Form required

  • Project Name)
  • Description)
  • Homepage URL (home page URL, usually named after the project name)

6. Create an SSH key

This step should be the most troublesome. Go back to the desktop, open git bash, and enter the following command.

Ssh-keygen-C 'your @ email. address'-t rsa

Confirm to use the default path, and enter the password you want to use twice (usually press a few keys without the password ).

7. Submit the key

Now, go back to the github page and find Account Settings in the toolbar in the upper right corner. On this page, there is an SSH Public Keys tag and select Add another public key. The Title is random. The Key is a piece of things.

Find the directory where the key was just created (default: C: \ Documents and Settings \ your windows username. ssh, OSX is ~ /. Ssh) Find the id_rsa.pub file and open it to view a pile of text. copy it and paste it to the key blank area on the github page. Then Apply.

Run the following command to test the connection:

Ssh-v git@github.com

You will be asked to enter the password you just set. If it succeeds, you can see this ERROR (orz, at least prove that the connection is successful)

ERROR: Hi Arthur raim! You 've successfully authenticated, but GitHub does not provide shell access

8. upload code

Finally, upload your code ~ Switch bash to your project directory and enter the following command.

Git remote add origin git@github.com: Your github user name/Your github project name. git

Git push origin master

Hehe, now go to http://github.com/your githubusername /your githubproject to see your project ~ Good luck

Of course, this is from scratch. If you have a git repo and want to add it to github, then you can directly use the 8th-step command (do not forget the key-related work ). In other words, many beginners should be the same as me. In the initial stage, they cannot figure out the relationship between git and github. git is a concept tied to CVS and SVN, while github is a concept tied to Google Code, sourceforge is a parallel concept, so you can understand it. For more information about git, see here.

BTW: the Community on Github is very good, and the experience is very good. No wonder so many people are happy to exchange code on github.

The last figure is shown.

GitHub Tutorials:

Create a personal technical blog via GitHub

GitHub tutorials

Git tag management details

Git branch management

Git remote repository details

Git local Repository (Repository) Details

Git server setup and Client installation

Git Overview

Share practical GitHub tutorials

GitHub details: click here
GitHub: click here

This article permanently updates the link address:

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.