My basic requirement: the code written locally on MacOS is expected to be backed up to a cloud server. The local code has a certain directory structure
1. Register your GitHub accountRegister your account (username +email address) on www.github.com and create a directory
2. Associating the local machine with the GitHub account associates the local machine with the GitHub accounts, the local machine can synchronize the code with the server. GitHub uses the SSH protocol. Specifically: to HTTPS://GITHUB.COM/SETTINGS/SSH inside the set. The exact steps follow the instructions here: Git is already installed on the Https://help.github.com/articles/generating-ssh-keys/macos. Just follow the steps above to make it easy.
3. Set local global information git config--global user.name ' your github user name ' git config--global user.email ' your github user email '
4. Create a local library to set up the appropriate directory locally, and then run the GIT init command under the directory to create a hidden directory in the current directory. Git
5. Associate the local library and the GitHub directory in the local library directory run git remote add origin [email Protected]:yourgithubname/yourgithubdirectory.git "origin" Equivalent to an alias, which is followed by the operation of the alias
6. Add a local file and submit it in the local library to run git add in the current directory of the local repository. Git commit-m "Your commit message" where "-M" means "-message", which is a description of the commit change. If you do not add this parameter, you will go to VI by default and edit the relevant instructions.
7. Upload the contents of the local library to GitHub above Git push-u Origin master, which uploads the local repository of the local origin alias to the code branch that master points to in GitHub. Note that the first time you operate push, the "-U" parameter is added to associate the local library with the master branch and the GitHub remote Master branch. This parameter is not required when you run the command later.
8. Subsequent operations, if the code is modified, GIT will automatically detect which code files have been modified. Run the git status command to see it. Just change these to git commit. If you add a directory or file, and then use git add, then git commit confirms it. Finally, GIT push Origin master blends the local library with the Cloud Code branch.
9. Pycharmpycharm MacOS version automatically supports git, just enable it in the VCs menu. After that, add, commit, and other related actions can be done through the menu. Moreover, Pycharm can easily compare the changes of two versions before and after a file, at a glance. Before commit, Pycharm can also organize your code, remove duplicate import, and so on.
On my local machine, however, the pycharm push operation is always unsuccessful. You must push with the command line under Terminal.
Finish.
"Using Notes" Git's use on MacOS is preliminary