Use GitHub to upload and manage your own code

Source: Internet
Author: User

Recently, I suddenly felt that my code was messy, and SVN and others seemed to have to build servers. This was not suitable for students, so I decided to upload the code to gitbub for management.

  1. Create a GitHub account

GitHub URL: https://github.com

Create your own account.

2. Download and install git download the latest version of git, GitHub provides an address: http://github-windows.s3.amazonaws.com/GitHubSetup.exe

Windows version can be downloaded here: http://code.google.com/p/msysgit/

It seems that the address has changed: http://code.google.com/p/msysgit/downloads/list? Q = Full + installer + official + git



Click Next to install the tool. After installation, perform the following settings:

Start to make some simple configuration. Configure user. Name and user. Email


(1) first you need to tell git your name, so that it can properly label the commits you make.

Set the GIT user. Name to facilitate the calibration of each commit.

[Plain]View
Plaincopy

  1. Git config -- global user. Name "your name here"

(2) git saves your email address into the commits you make. We use the email address to associate your commits with your GitHub account.

Set git's user. Email. Git will save your email every time you commit it. GitHub associates your commits with the GitHub account based on this email.

[Plain]View
Plaincopy

  1. Git config-global user. Email "your_email@youremail.com"

Your email address for git shocould be the same one associated with your GitHub account. If it is not, see this
Guide for help adding additional emails to your GitHub account. If you want to keep your email address hidden, this
Guide may be useful to you.

In general, your git email should be the same as your GitHub account email.

The steps listed above show you how to set your User Info globally. This means that no matter which
Repository you work in on your computer, you'll be making commits as that user. if you find yourself needing to make commits with different user info for a specific repository (perhaps for Work. personal projects), you will have to change the info in that
Repository itself.

Set User. name and user. email is used to let git record who is submitted each time. It was previously set as a global user. name, no matter which warehouse you submit, your name is his. If you want to use the specified name when submitting in the specified warehouse, you can enter the folder of the warehouse, input:

[Plain]View
Plaincopy

  1. $ CD my_other_repo
  2. # Changes the working directory to the repository you need to switch info
  3. $ Git config user. Name "different name"
  4. # Sets the user's name for this specific repository
  5. $ Git config user. Email "differentemail@email.com"
  6. # Sets the user's email for this specific repository

3. Create a repo create a repository

Log on to GitHub and click New repository.

The result is as follows:

You can enter a repository name. For others, readme can be initialized or not initialized. The next step is to create a ReadMe directly in githash.

(1) create a readme

Hello-world is the project name. My project is located in D: \ javacode \ javaprojects. Execute the following command in Bash to point to the project under drive D:

(2) commit your readme

Add the file to be uploaded after the GIT add command, locate the project to be uploaded, add the name of the file to be uploaded, or add all files in the project by git add.

Git comment-m'comment content' add comments for this upload

(3) push your commit

So far everything you 've done has been in your local repository, meaning you still havene' t done anything on GitHub yet. to connect your local repository to your GitHub account, you will need to set a remote for your repo and push your commits to it:

So far, you have performed operations in the local repository, but you have not yet pushed to the repository of GitHub remote server.

Now if you look at your repository on GitHub, you will see your readme has been added to it.

You can go to your GitHub to check whether there are any updates.

Attach your execution process and final result:

References:

Http://blog.csdn.net/benw1988/article/details/8492493

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.