Simple use of GitHub and Git

Source: Internet
Author: User

After downloading git in the GitHub site, run the git Shell (command-line window), we need several steps to complete a project release to the GitHub site

# # #git信息设置
1: Set account information: Git config--global user.name "own account"
2: Set mailbox information: Git config--global user.email "home Email"
View configuration list: Git config--list


# # #ssh配置 (local warehouse and service-side warehouse communication credentials)
3:ssh-keygen-t rsa-c "own email"//execution will let the input file name, secret, etc., all enter ignored, generated into the ~\.SSH directory (that is: C:\Users\Administrator\.ssh, you can type in the command Window CD ~\ . SSH and view files and contents)
4:ssh-add ~/.ssh/id_rsa//Add encryption key to warehouse
5:SSH-T [email protected] //test Connection Status


# # #仓库的建立

6: Create a server-side warehouse at the GitHub site (web interface Operations)

7: Create a local repository locally (2 ways):

One: Clone git clone from remote repository [email protected]: account ID/ project name . git

             II: Establish a local warehouse and associate a remote warehouse
                     Build a warehouse locally:
                             mkdir  project name
                              CD Project name
                             git Init
                      Associate a remote repository (that is, set up a remote branch):

git remote add olt git://github.com/account ID/ project name . Git//olt is the alias for the link, and method one establishes an alias of origin

At this point, the warehouse has been established, as follows to give the warehouse synchronization data related commands

# # #数据同步操作
1: Update remote files to local
git fetch OLT master//update content will be cached locally and the merge command needs to be executed to merge with local content
Git pull Olt master//Direct merge
2: Merging
git merge Olt/master
3: View
git status
4: Add a local warehouse
git add--all <path>/

git add--ignore-removal <path>
5: Submit to local repository
git commit-m "msg"
6: Submit to remote repository
git push-u olt Master
7: Rename the remote branch:
View branching git remote-v
GIT remote RM olt//Rebuilt repository need to re-execute the command and then re-remote add
git remote add Olt[email protected]:Account ID/Project Name. git




Simple use of GitHub and Git

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.