GitHub Upload Project Method:
Install Git on your computer
Git Bash Here
The general process for creating and correlating local git repositories and remote repositories is:
1. Initialize this local folder as a Git
manageable repository
Git init
Note: Git will automatically create a unique branch for US master
We can find a directory in the current directory .git
, this directory is git to track the management of the repository, do not manually modify the files in this directory, or change the mess, the Git repository to destroy.
2. Associate a local warehouse with a remote warehouse
git remote add origin [email protected]:littleredhatli/webpratice.git
[Email Protected]:littleredhatli/webpratice.git is the path to our remote repository (Webpratice is the name of the remote repository)
3. Create a new file
Touch Index
4. Add the new main.m file to the repository (so git will have 追踪
this file)
Git add index
5. Submit the file to the warehouse
" Commentary on the document "
6. Push the contents of the local library to the remote
Git push-u Origin Master
Note: For the first time push
, with -u
parameters, Git will associate the local master branch with the remote Master branch, and we will push
no longer need to add parameters to our operations -u
.
If one day we have modified the mian.m file
Modify the index file
- We can use
git status
View status
- Adding files to the Git repository is actually
文件修改
adding to the暂存区
Git add index
Git commit-m "Commentary on a file"
git push
- Commit changes to push the latest changes to the local current branch to the remote repository on GitHub
github上传(git push)时出现error: src refspec master does not match any
The cause of this error is that there are no files in the directory and an empty directory cannot be submitted.
Solutions
Touch Readme
git add README
git commit-m "Commentary"
Git push Origin Master
If you already have a file on GitHub remote, an error will occur. At this point, you should pull the first, namely:
Git pull Origin Master
And then proceed:
Git push Origin Master
Local git repository and remote repository creation and correlation and GitHub upload (git push) error:src Refspec master does not match any solution