GitHub Warehouse Management

Source: Internet
Author: User
Tags commit ssh

1, build a warehouse on GitHub.


2, ensure that Git is installed locally. and configured well: $ git config--global user.name "YourName"

$ git config--global user.email "youemailaddress"


3, use SSH to generate the key and configure the public key on GitHub:

$ ssh-keygen-c "youemailaddress"-t RSA


4. Create a local repository and upload the code to GitHub:
1> Create a good file in the local project directory.
2> $ git init (initialize a git repository)
3> $ git Add. (Add all files to the warehouse)
4> $ git commit-m "commit info" (commit)
5> $ git Remote Add Origin git@github.com:yourname/yourrepositroy.git (add source to GitHub)
6> $ Git push-u origin master (upload source to GitHub)

----------------
If the submission fails, the following error message is returned:
Error:failed to push some refs to ' git@github.com:******/demo.git '
Hint:updates were rejected because the tip of your current branch is behind
Hint:its remote counterpart. Merge the remote changes (e.g. ' git pull ')
Hint:before pushing again.
Because of the remote repository and the local repository conflict, after creating the repository, the GitHub repository page clicked on the Create Readme.md file button to create the description document, but did not pull to the local. This creates a problem with version conflicts.


There are several workarounds:
1. Use the force Push method:
$ Git push-u origin master-f
This will make remote modification lost, is generally undesirable, especially when multi-person collaborative development.
Remote repository modification pull down before 2.push
$ Git pull Origin Master
$ Git push-u Origin Master
3. If you do not want to merge remote and local modifications, you can create a new branch first:
$ git branch [name]
$ Git push-u origin [name]

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.