Linux git and GitHub usage summary (Code cloud)

Source: Internet
Author: User
Tags using git git clone

Beginners first remember these, others slowly study.

Here's how to use the code cloud to complete a project submission, my steps

Https://git.oschina.net/phpervip/qianzhu (This example: an Enterprise Template):


    1. Register an account on the code cloud first.

    2. Then you create a new project, and you have a git address.

    3. Go to your project directory locally.

      Initialize Project--Build remote connection--Get project--add version---version submit, remote submit

      Git init

      Git remote add Origin https://git.oschina.net/phpervip/qianzhu.git


      Git pull origin

      git add *

      Git commit-m ' first commit '

      Git push origin

      git push origin-f

      Because the remote already has a file, the submission does not go up,-F is forced to commit.

    4. That's good!

    5. How to install Git. Take a look at the following article.


----



Linux git and GitHub use method summary 2014-11-26 11:29:53

Category: Embedded


1 building git and GitHub environments under Linux

First step: Install git and use the command "sudo apt-get install git"

Step two: Create a GitHub account on GitHub

Step three: Generate SSH key, use the command "ssh-keygen-t rsa-c" [email protected] "", Your_email is your email

Fourth step: Go back to GitHub, enter account Settings, the left choice ssh keys,add ssh key,title casually fill, paste Key. Key is

~/.ssh/id_rsa.pub content.


Fifth step: Test SSH key is successful, use the command "ssh-t [email protected]", if appear you ' ve successfully authenticated, but GitHub does not provide shell Access. This means that you have successfully connected to GitHub.

Sixth step: Configure git configuration files, username and email

git config--global user.name "your name"//Configure user name

git config--global user.email "your Email"//Configure Email


2 using Git to upload locally to GitHub

Step one: Go to the directory where you want to upload the file enter the command "Git init"

Step two: Create a local repository origin, using the command "Git remote add origin [email protected]:yourname/yourrepo.git"
Youname is your github username, Yourrepo is the repository you want to upload to GitHub, which you add on GitHub.

The third step: for example, you want to add a file xxx to the local repository, using the command "git add xxx", you can use "git Add." Automatically determine which files to add

Then add this to the local repository, using the command "Git commit-m" to explain this commit ""

Finally, submit the local repository origin to the remote GitHub repository using the command "Git push Origin master"


3 cloning projects from GitHub to local

Step one: Go to a warehouse in GitHub and copy the "HTTPS clone url" to the right

Step two: Go back to the directory you want to store, use the command "Git clone https://github.com/chenguolin/scrapy.git", the red URL is just an example

Step three: If the local version is not up-to-date, you can use the command "Git fetch origin", Origin is the local repository

Fourth Step: Merge the updated content into the local branch, you can use the command "git merge Origin/master"


If you do not want to manually merge, then you can use: Git pull < local repository > master//This command can be pulled to the latest version and automatically merged


4 GitHub's branch management

Create

1 Create a local branch: GIT branch < new branch name >

2 Synchronizing a local branch to GitHub: Git push < local repository name > < new branch name >

3 Switch to the newly established branch: Git checkout < new branch name >

4 Add a new remote end to your branch: Git remote add < remote End name > < address >

5 View the current warehouse has several branches: Git branch

Delete

1 Delete a branch from the Local: git branch-d < branch name >


2 Sync to github Delete this branch: git push < local repository name >:


5 Common errors

==

Still do not understand, please read one more article:

https://my.oschina.net/u/1050949/blog/194536



Linux git and GitHub usage summary (Code cloud)

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.