Upload local files to GitHub
Recently, I made an automatic monitoring system for operation and maintenance with reference to the idea of an open course. I want to upload the code to a GitHub built by the teacher on this side of our information center in order to learn and communicate. A pit was encountered during the upload process. The detailed process is described below for subsequent reference (GitHub address: https://202.207.177.110). My local environment is Centos6.3
1. First of all, build a project on GitHub, which is very easy, so I won't repeat it.
2. Set the global environment locally (the username and mailbox here are the usernames and mailboxes I used when registering)
# git config-global user.name "fsy"
# git config-global user.email "2663154088@qq.com"
3. Generate a pair of keys locally, and place the public key in the public key location in the settings of GitHub (this is very important, because I did not do this step, so I cannot upload)
# ssh-keygen-t rsa-C "2663154088@qq.com"
4. Create a new knowledge base
# git clone git@202.207.177.110:fsy/test.git (this path comes from the path where the project was created above)
5. Add the project file to the repository (premise: the file you want to upload has already been placed in the test directory)
# cd test
# git add.
6. Commit the file to be added to the warehouse
# git commit-m "name" (note that you must have a name for each upload, which can be defined by yourself)
7. Upload the code to the remote GitHub warehouse
# git push-u origin master
At this point, the upload is complete.
Add: if it is an existing directory, add content to it
# cd test
# git init
# git remote add origin git@202.207.177.110:fsy/test.git
# git add.
# git commit-m "name"
# git push-u origin master
Welcome to criticize and correct!