git command--upload code

Source: Internet
Author: User

To create a key command:

Ssh-keygen-c ' [email protected] '-t RSA

Locate the generated key file Id_rsa.pub address: C:\Documents and Settings\administrator\.ssh\id_rsa.pub
Copy, and then add it to your GitHub account

Input command: $ ssh–t [email protected]
If prompted: Hi defnngj you ' ve successfully authenticated, but GitHub does not provide shell access. It means you are connected successfully.

If you create a new project now, would you like to submit it to GitHub?

Let's say you've created a project and switched to the project's root directory:

$ git status//view the status of all the articles under the current project, if first you will find all the red color as it has not been handed over to Git/github management.

$ git Add. The (.) dot represents everything under the current directory and is given to git management, which is the local repository that was committed to git.

Ps: The power of git is that there is a concept of a local repository that can submit the updated content to the local repository without a network.

$ git commit–m "new Natter" //A description of what you have updated or modified.

$ git Remote add origin [email protected]:defnngj/hibernate-demo.git

If you are submitting your project for the first time, this is a very important sentence, which is the current project in your local connection to the remote repository.

Ps: origin can be changed to someone else's name, but the next time you push (submit), you will have to use your modified name.

$ git remote-v //view which warehouse address your current project is remotely connected to.

$ Git push-u origin master //submits the local project to the remote repository.

Some of the issues that you may encounter are resolved:
If you enter Git remote add origin [email protected]:d Jqiang (GitHub account name)/gitdemo (project name). Git
Tip error Message: Fatal:remote origin already exists.
The solution is as follows:
1. First enter GIT remote RM origin
2, then enter the GIT remote add origin [email protected]:d Jqiang/gitdemo.git will not error!
3. If you enter GIT remote RM origin or an error, 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 the [remote "origin"] that line to delete the good!
If you enter $ ssh-t [email protected]
Error message: Permission denied (PublicKey). Because the newly generated key cannot join SSH, it will cause the connection to not be on GitHub.
The solution is as follows:
1, first enter $ ssh-agent, and then enter $ Ssh-add ~/.ssh/id_key, so you can.
2, if still do not, enter Ssh-add ~/.ssh/id_key command after the error could not open a connection to your authentication agent. The workaround is key with the Git GUI SSH tool Generated, so that when 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 if you copy the contents of the Id_rsa.pub file there is no extra space or blank lines, some editors will help you add these.
If you enter a GIT push origin master
Tip error 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 down
2. Then enter $ GIT push origin master
3. If an error occurs 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 [email protected]:d Jqiang/gitdemo.git
The process of using Git to create a project locally
$ makdir ~/hello-world//Create a project Hello-world
$ CD ~/hello-world//Open this project
$ git init//initialization
$ Touch README
$ git Add Readme//Update Readme file
$ git commit-m ' first commit '//submit update and Comment message "First commit"
$ git Remote add origin [email protected]:d efnngj/hello-world.git//Connect remote GitHub Project
$ GIT push-u origin master//update local project to GitHub project
Browse the HTML code on github directly in your browser:
http://htmlpreview.github.io/

git command--upload code

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.