Upload Local code/file->github
Toss for half a day ...
Pre-GitHub Preparation section
1) Login to GitHub and create a new repository
2) Repository naming
3) GitHub is a managed platform, equivalent to a server, if you want to operate it, you must also install a GIT client, using the appropriate GIT instructions to operate it
GitHub Client Download & Install
GitHub Client: Https://git-scm.com/download
If it is a Windows operating system, select as above ↑
GitHub Client Configuration
1) Go to the directory you want to upload (you can also use the Linux command to switch directories on the desktop, GitHub Command dialog box), right-click to choose Git Bash here
2) Typing git init on the command line will come up with a. git folder, which means that the local git creation was successful. First time local operation requires the GIT init command to be executed first
3) Set SSH key to create the SSH key locally
Command: SSH-keygen- t RSA- C "[email protected]" (here to replace the registered GitHub mailbox) command input and always hit enter. The generated key file defaults to C:\Users\Windows\.ssh (here is the user directory of the currently logged on computer)
If you need to configure a password, enter the password in the prompt box
4) cut back to GitHub website, go to account Settings, choose SSH and GPG keys----New ssh key on the left
Title fill it out, key content: Open the generated SSH key file, copy the content, paste. Click Add SSH key
5) Verify the success, enter SSH-T [email protected] In the GitHub Command dialog box
6) The next thing we need to do is to upload the local code to GitHub, and we'll have to set up username and email, because GitHub will record them every time it commits.
GitHub Code Command mode upload
7) The key step came. The command to upload the code (in fact, GitHub above tells you how to upload, the previous steps are ready to work )
Enter the following command in the GitHub command Input box:git Add. All directories and files under upload directory git commit-m "firstcommit" to replace its own comment https://github.com/chwilliam85/ Test.giT replaces your GitHub username and the project directory name that needs to be uploaded git push-u origin master
git add fileName to upload a specific file
GitHub file (FTP-like) upload
Full reference to the upload steps provided by GitHub
1) newly created repository
2) Enter the directory of the code you want to upload, right-click Git Bash here and open the GitHub command input box. Follow the upload steps provided by GitHub to execute the corresponding command
3) After the command finishes the Refresh page, click the Upload file button Upload files
4) Drag file upload (the key steps are always at the end)
Github uploads code in two ways