Use git to upload local project files to the code hosting platform

Source: Internet
Author: User
Tags ssh hosting

1. Build the warehouse on the code hosting platform first

2. Create an SSH key locally
Ssh-keygen-t rsa-c "Hll19950830nomail@code.csdn.net"

3. Add the locally generated SSH key in the SSH public Key management of the code hosting platform

4. Global Settings username and email
$ git config--global user.name "hll19950830"
$ git config--global user.email "hll19950830nomail@code.scdn.net"

5. Enter the local project folder to create the README.MD
Touch readme.md

6. Go to the Local project folder to initialize the local project
Git init

7. Select Upload Current Folder
git Add.

8. Determine the submission
Git commit-m "Add EmpManage1.0"

9. Connect to the remote Git repository (git@code.csdn.net:hll19950830/empmanage1-0.git is the Remote repository address)
Git remote add Origin git@code.csdn.net:hll19950830/empmanage1-0.git
Git push Origin Master

If you execute git remote add Origin git@code.csdn.net:hll19950830/empmanage1-0.git,
Error occurred:
Fatal:remote origin already exists,
The following statement is executed:
Git remote RM origin
Then execute git remote add Origin git@code.csdn.net:hll19950830/empmanage1-0.git

When you execute GIT push Origin master,
Error:
error:failed to-push som refs to ....
The following statement is executed:

Git pull Origin Master
First, the remote server github above the file pulled first, and then push up.

Or use the Git Pull--rebase Origin master command to merge Code "note: Pull=fetch+merge"
Execute the statement again GIT push Origin master







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.