Upload a local project to GitHub with Git

Source: Internet
Author: User

  1. First make sure you have git installed, open git bash, enter ssh-keygen-t rsa-c "own mailbox address @xxx.com", generate your own public key and private key

  2. The default carriage return, the public key, the private key to the following folder Id_rsa is the private key, id_rsa.pub is the public key, open the public key, etc. to use

  3. Browser into your own github, open settings, go to ssh and GPG keys

  4. Click New SSH key, fill in the title yourself, the following copy of the previous open public key, and finally add

  5. You can use Ssh-t [email protected] test Whether you can connect successfully, there is an input in the middle to enter yes, you can see Hi XXXX .... access indicates success.

  6. After the connection is successful, the user information needs to be set

  7. To create a project on github, Remember to create a successful https, the following

  8. Git bash go to the local project directory, enter the following command, if the local project directory already has some files to upload, need git add * add, and then git commit-m "XXXX" and git push up, there will be asked user name and password in the middle

    To this successful upload GitHub is Over. Hereby record

    Attach a collection of common commands:

    git common command git init here-create a local repository (repository), will create A. Git folder under the folder, the. git folder stores all the version information, tags and other content git remote add origin [email protected]:winter1991/helloworld.git--associate a local warehouse with a remote REPOSITORY. If you do not execute this command, each push will need to specify the address of the remote server git add--from the local repository additions and deletions, the results will be saved to the native cache git rmgit commit-m "comment"--commit,  The contents of the native cache are submitted to the HEAD of the native GIT push Origin master-push the local commit (commit) to the remote server, origin is the previous GIT remote add origin command Origin,origin replaces the server warehouse address: git push [email protected]:winter1991/helloworld.git Mastergit pull Origin master--from the remote service New changes to git status-view status git add-a--commit all Changes 1. git configuration: git config--global user.name "xxx"--configure user name, upload local repository to the server, on Github will display the configured uploader information in git config--glob Al User.email "xxx"--configure the mailbox git config--list view configuration list configuration sshkey: Use this sshkey to confirm upload permissions when uploading code 1. Create a local ssh:ssh-keygen-t rsa-c "Github registered mailbox" 2. Add this sshkey to Github: copy C:\Documents and settings\administrator\.ssh\id_rsa.pub the contents of the file; login to Github--account Setting---ssh-key---Add SSH -key---paste the contents of the id_rsa.pub; 3. Verify: ssh-t [email protected] appears Hi xxx! You've successfully authenticated, but GitHub does not provide shell access. Note the configuration is successful and can be connected to Github 2.                    Set up warehouse Repository:git init here--create a local repository git remote add origin [email protected]: username/repository name. git --associate the local repository with the remote repository, and if you do not execute this command, you will need to specify the remote Server's address 3 each time you Push. Download new changes from the remote repository: git pull Origin master4. Commit local modifications to the remote repository: git addgit add-a-add changes to the local repository git RM xxx-delete The specified file from the local repository git rm-r xxx-removes The specified folder from the local repository git commi T-m "comment"--commits the contents of the native cache to the HEAD of the native GIT push Origin master--push the local commit to the remote repository 5. Ignore the specified content using The. gitignore file: 1. Create A. Gitignore file at the local warehouse Root. Win7 cannot be created directly, you can create a ". gitignore." file, and the following punctuation is automatically ignored; 2. Filter files and folders: [tt]emp/filter temp\temp folder; *.suo filter. suo file; 3. Do not filter files and FOLDERS:!*.C

Uploading local items to github with 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.