Git local project uploads & Sourcetree & GitHub easy to use

Source: Internet
Author: User
Tags git client using git version control system git commands sourcetree

Git (Distributed version control system)

Git is a free, open source distributed version control system for agile and efficient processing of any or small or large project.

Git is an open source distributed version control system for efficient, high-speed processing of project versioning from very small to very large. Git is an open source version control software developed by Linus Torvalds to help manage the development of the Linux kernel. A

Git can help us solve issues such as file submission, checkout, backtracking history, conflict resolution, multi-person collaboration patterns, and more.

Today we are going to introduce GIT version management tool Sourcetree:

Sourcetree is a free Git client under Windows and Mac OS X that supports operations such as create, clone, commit, push, pull, and merge.

Sourcetree has both Gitbash command line, Egit graphical management, user interface is very human, greatly simplifies the git operation between the developer and the code base, which is very useful for developers who are unfamiliar with git commands.

Attached to Sourcetree:



Git is a distributed version control system and an open source library.

Attached Online reference blog:

Registration and the GitHub interface are no longer detailed.

We start with the text:

I. Creating a remote Repository

1. First enter the personal center, click the Avatar Select your profile

2. Next we select the warehouse and new one

Create Warehouse 3. The operations for creating warehouses are as follows
Detailed description
Created successfully Second, configure SSH Key

When we use GitHub, each push operation requires us to log in the user name and password, which can greatly reduce the efficiency, for we can use another solution when uploading-ssh key, SSH key can help us remember the user name, We also have special protections for our passwords.

Why does GitHub need SSH key? Because GitHub needs to recognize that your push submission is actually pushed by you, not someone else impersonating it, and Git supports the SSH protocol, so if GitHub knows your public key, you can confirm that only you can push it.

1. Check and remove SSH key

Before configuring, let's check if there is an. ssh file in your computer, and if so, delete our new configuration from the following steps:

Click Finder, go to folder, Jens is my host name, when you write your own

Description: this. ssh file belongs to hidden file, we can show hidden file through terminal

command to show Mac hidden files: hide mac hidden files command: Howallfilesno

After doing the above steps, we check to see if there is a. git file in the project to be uploaded, and if so, delete it (I'm testing it with a blank demo)

2. Create a new. ssh file using a terminal

To prevent errors, the following command suggests an assignment to paste

mkdir. SSH

3. Switch the current directory to the. SSH folder


4. Create a public and private key

Ssh-keygen-t rsa-c "Enter your e-mail"

Next we will enter the password and so on, directly enter, do not do any action, such as

Creating public and private keys
5. To see if there is a id_rsa (private key) (public key), the presence succeeds.


6. Copy the public key

Pbcopy < ~/.ssh/

7. Configure the public key on GitHub

Since we just executed the copy command, the above directly cmd+v on it, then add SSH key

Add Public key

8. Execute the following command

ssh-t [email protected]

Activating the public key
Third, upload the local project to GitHub 1. Build a git repository

If you have a. git file in the project directory that you want to upload, it is recommended to delete it, and use the terminal to switch to the directory you want to upload and execute

Git init

2. Add all the files in the project to the warehouse

Note that after add there is a. Recommended Assignment Paste

git Add.

3. Commit the files we added to the Git repository and add comments

git commit-m "comment statement"

4. Next we associate the local warehouse with the warehouse on GitHub

Git remote Add the address of the warehouse on Origin GitHub

Copy Warehouse Address

5. Before uploading, we'll pull it from git.

Git pull Origin Master

This process may allow you to enter GitHub's account name and password (note: Password input is not displayed), the following will appear when the input is completed

This is the VI compiler window, do not need us to do the operation, the direct exit can be,

Click Keyboard I enter edit mode, click ESC-Input: WQ-> Return

6. Push local project to remote repository

Git push-u Origin Master

At this point we see that we also enter a git account and password, input can! Waiting to be done we can see our project on GitHub.

Upload the local project, here is the end, below we introduce the GIT version management tool simple use.

Iv. simple combination of sourcetree and GitHub

1. Understanding the Sourcetree interface

Interface One

When installed, you will be prompted to log in and log in directly to your GitHub account.

Select an item to enter Interface II (working copy)

Interface Three (master)

2. Familiarize yourself with several operations

Commit-commits the modified content to the local repository

pull-a code block that pulls modifications from a remote repository

push-pushing locally modified content to the remote repository

3. Clone (clone) project from remote repository to local

Here we introduce two methods of cloning:

The first: HTTPS URL, for beginners using git is relatively simple, we only need to assign HTTPS URL link, using the GIT version management tool or command line instruction to clone to local.

The second type: SSH URL, if you want to use the SSH URL to clone, we need to configure the SSH key before cloning

A. Copy the cloned link address, where we use the SSH URL clone.

Copy a cloned URL

B. Open Sourcetree, create a cloned project from the URL

Create a new warehouse

C. Enter the address copied in step a

Clone Warehouse

D. After successful cloning, double-click to open the following screen

In the process of cloning, we may let us enter the account number and password, remember to enter the GIT account password!

4. Modify project push to remote server

A. Let's turn on the clone to local project from GitHub and make a few changes.

Print Log

B. Then we find that the Sourcetree interface has changed, and it will count some of the changes we've made.

Introduction to the Push interface

C. Next, we submit the modified content to GitHub

Push to GitHub interface

Step 3 If you choose, the equivalent of we commit the changes to the local repository, and push to the remote repository,

If we do not tick the point of submission, we also need to click "Push" on the menu bar to push the changes to the remote repository push.

If you do not make an error, it means push succeeds.

D. Check if the warehouse on GitHub has changed

Check for changes on GitHub

5. Pull changes from remote

When you save your edits, the default tick is "Commit directly to the master branch." and add the modifications to the main branch.

After the modified

Next we can use the Sourcetree to pull pulls, pull the popup when the prompt box, the default selection of direct confirmation is good

of the Pull interface

Check it out and we'll see that the local repository synchronizes with the remote repository

Check for results after pull

things more, do when you must be careful, if there are any questions and comments can contact me, welcome to shoot bricks, to be learning GitHub and git tools you/:)

Reference Link: 1.

Git local project uploads & Sourcetree & GitHub easy to use

Related Article

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: 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.