Reference blog: http://www.cocoachina.com/ios/20161009/17698.html
2 Start to build a local library and continue typing in the terminal
1.cd to the destination folder.
2. git init (want to create a new git repository on this machine)
3. git add -A (here -A means to add all files of the target file to git, if you don't need to add all files, you can replace -A with a specific file name)
4. git remote add origin xxxxxxxxx xxxxxx is the address of your warehouse
5. git commit -m "firstCommit" ("firstCommit" can also be changed to other descriptive text, which will eventually be displayed after the file name in the github interface)
As shown in the red box below
When uploading the code for the first time the following happens:
*** Please tell me who you are.
Run
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'crystal@crystal-Inspiron-5425.(none)')
Here is to let you enter the user.email and user.name of the global project. Of course, each project can also set the local user.email and user.name. Due to the initial use, enter the following commands according to the prompts
git config --global user.email "*****@gmail.com"
git config --global user.name "crystal"
6. git pull --rebase origin master update remote update to local
Push local updates to remote:
7. git push origin master (git push -u origin master) Merge the local repo with the remote origin repo, the first time you use -u, the system requires you to enter the account password
will appear
Username for 'https://github.com':
Password for 'https://[email protected]':
Enter the github account password as prompted
8.git pull