How to upload native code to github with git command line

Source: Internet
Author: User

Note: The prerequisites for installation are to configure the relevant environment for git or install Git.exe, which is no longer highlighted here

Steps to upload:

This article uses the GIT command interface to operate, first execute the following two commands, configure user name and email "set username and e-mail address." This is important because this information is used every time that git commits. It is permanently embedded in your submission . "

git config--global user.email "[Email protected]"
git config--global user.name "Your name"

Then start creating the project and submit it to the remote Git repository in the following steps:

1. Go to the Local project directory, right-click "Git Bash here", bring up the git command line interface, and enter

      Git init

2. Upload all files in the directory, or you can "." Change to a specific file name

      git Add.

3. Submit the project to the local warehouse

      " Comment Statement "  

4. Create a new repository on GitHub

5. Click "Create Repository" to jump to a connection, the following red circle to get to the GitHub address of this project

6. Associating local code to GitHub

          GitHub address for Git remote add Origin project

7. Upload the code to GitHub before you need to pull

         

8. Upload code to a remote git repository

         Git push-u Origin Master

9. Enter your GitHub account number, password, and the code will be uploaded successfully.

By this step, the code was successfully uploaded to the remote repository.

---------------------------------------------------------------The following are errors that may occur-------------------------------------- ------------------------

If you enter Git remote add origin [email protected]:d Jqiang (GitHub account name)/gitdemo (item name). git

Tip out the wrong message: Fatal:remote origin already exists.

The solution is as follows:

1. First input $ git remote RM origin

2. Re-enter Git remote add origin [email protected]:d jqiang/gitdemo.git will not be wrong!

3. If input git remote RM origin is still wrong, error:could not remove config section ' Remote.origin '. We need to modify the contents of the Gitconfig file

4. Find your GitHub installation path, mine is C:\Users\ASUS\AppData\Local\GitHub\PortableGit_ca477551eeb4aea0e4ae9fcd3358bd96720bb5c8\ etc

5, find a file named Gitconfig, open it to delete the inside of the [remote "origin"]那一行 good!

If you enter $ ssh-t [email protected]
Bug tip: Permission denied (PublicKey). Because the newly generated key cannot join SSH, it will not connect to GitHub.

The solution is as follows:

1, first input $ ssh-agent, and then input $ ssh-add ~/.ssh/id_key, so you can.

2, if still do not, enter Ssh-add ~/.ssh/id_key command after the report wrong could not open a connection to your authentication agent. The solution is key with Git
GUI of the SSH tool generation, such as the creation of the key is stored directly in SSH, do not need to ssh-add command to join, and other user,token and other configurations are done with the command line.

3, it is best to check the contents of your copy id_rsa.pub file There are no extra space or blank line, some editors will help you add these.

If you enter GIT push Origin master

Tip out the wrong message: error:failed to push som refs to ....

The solution is as follows:

1. First enter the GIT pull Origin master//start the remote server github file

2. Re-enter GIT push Origin master

3. If the report is wrong FATAL:COULDN ' t find remote ref Master or fatal: ' Origin ' does not appear to be a git repository and fatal:
Could not read from remote repository.

4. You need to re-enter Git remote add origin[email protected]:d jqiang/gitdemo.git

How to upload native code to github with git command line

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.