Android environment configuration: Configure git and github in ubuntu

Source: Internet
Author: User

1. Requirements and Environment
Hardware: a pc or virtual machine with an Ubuntu System (tested as Ubuntu11.10)
Software: openssh-server, openssh-client, git-core
2. install and configure the git Server
A. Install ssh. Because git is based on the ssh protocol, you must first install ssh:

  1. Sudo apt-get install openssh-server openssh-client
After installing ssh, start the ssh service:
  1. Sudo/etc/init. d/ssh restart
B. Install the git Server:
  1. Sudo apt-get install git-core
3. Apply for a github account
If you just want to copy the code you are interested in on github to your local computer, or use the git tool to manage the local code, you have completed the configuration of git in ubuntu by executing step 2, you can use git to manage code.
However, if you want to submit the code to github for management, You need to register a new account on github. The specific registration steps are omitted.
4. Configure the ssh Public Key
A. First, generate an ssh Public Key locally.
  1. Ssh-keygen-C 'your emaildress '-t rsa
For example, ssh-keygen-C 'dongyuchi @ gmail.com '-t rsa
Will be in the user directory ~ /. Ssh/
You can use the ssh-v git@github.com command to test whether the link is unblocked
  1. Ssh-v git@github.com
B. Upload the public key to github.
In the account profile, select the ssh keys option and Add the SSH Key ~ The content in/. ssh/id_rsa.pub is copied and uploaded.
After the upload is successful, you will receive a confirmation email. You can use the ssh-v git@github.com command to test whether the link is unblocked.
5. manage projects
A. Create a warehouse
Create a new directory as the repository directory. Go to the directory and run the git init command to initialize the repository. After the initialization is complete, A. git hidden file is added to the directory.
  1. Git init
B. git Configuration
  1. Git config -- global user. name "Your Real Name"
  2. Git config -- global user. email you@email.address
C. Add a file
  1. Git add ./
This is to add all files under the directory. If you only add a file, the file name will be listed. if you add a directory, you can use * instead.
D. commit Project
  1. Git commit-m' my first version
-M is followed by a description of the project.
E. Upload a project
  1. Git remote add origin git@github.com: Your github user name/Your github project name. git
  2. Git push origin master
When executing push in this step, the system may require you to pull first, then pull first, and then push again.

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