Overall process:
- Have a github account and create a new warehouse (remote); (a warehouse is understood as a project that can be managed by git)
- Build a warehouse locally;
- The local warehouse and the remote warehouse are connected;
- Push the code of the local warehouse to the remote warehouse;
Specific steps:
- Have a github account and create a new warehouse (remote);
After creating a new one, there will be such an address, save it
-
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
entergit init,
, you will find that there is an additional .git file in the folder.
Inputgit 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
-
The local warehouse and the remote warehouse are connected;
inputgit remote add origin https://github.com/xxxxx/helloworld.git
, the following address is the address we saved in the first step -
Push the code of the local warehouse to the remote warehouse;
inputgit 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
) 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.