git upload project to github

Overall process:

  1. Have a github account and create a new warehouse (remote); (a warehouse is understood as a project that can be managed by git)
  2. Build a warehouse locally;
  3. The local warehouse and the remote warehouse are connected;
  4. Push the code of the local warehouse to the remote warehouse;

Specific steps:

  1. Have a github account and create a new warehouse (remote);
    insert image description here
    insert image description here

After creating a new one, there will be such an address, save it
insert image description here

  1. Build a warehouse locally. You can create a new folder, copy the project to be uploaded, or directly find the project you need to upload, open the folder, right click, select git bash here and
    insert image description here
    enter git init,, you will find that there is an additional .git file in the folder.
    insert image description here
    Input git add .(), select this time Files to Commit
    git add is a Git command for adding files to the cache (also known as the staging area) of a Git repository. This means that you can use the git add command to temporarily put new or modified files into a temporary storage area before committing your changes so that you can commit those changes together in the same commit. Dot. means all files, such asgit add readme.txt

    Input git commit -m "add README.md", inside the quotation marks is the comment information, you can write whatever you want, the purpose is to tell others what has been updated this time, and it will be displayed on github
    insert image description here
    insert image description here

  2. The local warehouse and the remote warehouse are connected;
    input git remote add origin https://github.com/xxxxx/helloworld.git, the following address is the address we saved in the first step

  3. Push the code of the local warehouse to the remote warehouse;
    input git push -u origin master
    -u: This is an option (also can be written as --set-upstream), which is used to associate the local branch with the remote branch. By using the -u option, after associating the local branch with the remote branch, you can use the simplified command git push to push in the future without specifying the name of the remote branch.
    origin: This is the name of the remote repository. In a typical case, origin is the default remote repository name, which points to the repository from which the project was originally cloned.
    master: This is the name of the local branch to push. In this case, it's the main branch (usually the default main branch
    insert image description here
    ) github.com/xxxxx/helloworld.git/': OpenSSL SSL_read: Connection was reset, errno 10054, the reason is that the network is not good, the solution is to hang a proxy

After hanging the agent and then pushing, there will be no problem

attached

After submitting, wait until the next time the project is modified, and then submit without git init.
Just use add, git push directly after commit.

Guess you like

Origin blog.csdn.net/Bad_foxS/article/details/130620723