GitHub upload Files

Source: Internet
Author: User
Tags git client

GitHub is a git-based code hosting platform, where paid users can build private warehouses, and our general free users can only use public repositories, which means the code is open. Public repositories are sufficient for the average person, and we don't have much code to manage, O (∩_∩) o~. Here is a summary of some of my simple use, for beginners reference.

1. Register your account and create a warehouse

The first step to using GitHub is, of course, registering a GitHub account. After that you can create a warehouse (free users can only build public warehouses), create a New Repository, fill in the name after create, there will be some warehouse configuration information, this is a simple git tutorial.

2. Installing the client Msysgit

GitHub is a server, we need a git client to use git on our own computer, I choose Msysgit here, this just provides the core functionality of Git, and is based on the command line. If you want a graphical interface, just install Tortoisegit on msysgit basis.

After loading the msysgit right mouse will have some more options, in the local repository right-click Git Init here, will be more than a. git folder, which means that the local git created successfully. Right-click Git bash to go to the GIT command line and configure SSH key to upload the local repository to GitHub.

3. Configure Git

First create the SSH key locally:

$ ssh-keygen-t rsa-c "[Email protected]"

The following [email protected] changed to your mailbox, then asked to confirm the path and enter the password, we use the default all the way to the line. Successful words will be generated under ~/. SSH folder, go in, open id_rsa.pub, copy the key inside.

Go back to GitHub, go to account Settings, choose SSH keys,add ssh key,title on the left, and paste the Key. In order to verify success, enter it under GIT bash:

$ ssh-t [email protected]

If it is the first time will prompt whether continue, enter Yes will see: You ' ve successfully authenticated, but GitHub does not provide shell access. This means that you have successfully connected to GitHub.

The next thing we need to do is upload the local repository to GitHub, and then we'll have to set up username and email, because GitHub will record them each time it commits.

$ git config--global user.name "your name" $ git config--global user.email "[Email protected]"

Go to the repository you want to upload, right-click Git Bash, add remote address:

$ git Remote add origin [email protected]:yourname/yourrepo.git

The following yourname and Yourrepo indicate that you re-github user name and the newly created warehouse, added after the addition of the. git, open config, here will be a remote "origin" content, this is just added to the long-range address, You can also modify config directly to configure the remote address.

4. Submit, Upload

Next, add some files to the local repository, such as the Readme,

$ git add readme$ git commit-m "First commit"

Upload to GitHub:

$ GIT push origin master

The git push command pushes the local repository to the remote server.
The git pull command is the opposite.

After modifying the code, use GIT status to view the file differences, use git add to add files to commit, or use Git add-i to add files intelligently. After Git commit commits this modification, git push uploads to GitHub.

GitHub upload Files

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.