First of all, make sure that git is installed on your computer and has been configured and the public key has been set in the remote warehouse. The remote git repository I use is gitee (code cloud).
1. Create a git remote warehouse and associate it locally
Create a git remote warehouse
After clicking Create, a secret key will be generated for local connection
to clone the warehouse to the local, which also realizes the association between the remote and the local. The command git clone [SSH of the remote warehouse] is used to
clone the files and the remote git library The same as the file (this .git is a hidden file)
2. Create a new python project
Let's create a few files at will
At this time, our project is not abnormal, and the following operations will make changes
3. Copy the cloned file to the python project
At this time we return to pycharm, some icons have changed
At this time, the red file indicates that it has not been submitted
4. Submit the project
There are two methods to submit the project. It is recommended to use method 2:
Method 1:
Use the icon generated later to commit
and select all the files. The √ on the right can be canceled. Fill in the submission comments below and click Submit.
Method 2:
Just use the command method, you can use the command in the Terminal in pycharm to submit
and check the file status, indicating that it has entered the cache.
After the submission, the project file turns green and
then submitted to the local git warehouse
and then submitted to the remote, so that Entered our remote git warehouse
to view the information of the remote git warehouse
Even if the above is that Pycharm is associated with remote Git
Let's add the use of .gitignore files
What is written on this file is to explain what files to upload when uploading, or what files to ignore and not to upload
After editing the .gitignore file, remember to submit it, don’t forget this!
The following are some examples and usage rules.idea
/ indicates that the files included in the idea are not added.
#/ indicates the directory where the current file is located
#Ignore all directories and files under public
/public/*
#Do not ignore /public/assets, which means a special case, the assets file does not ignore
!/public/assets
#Ignore the specific file
index.py
#ignore all php
*.php
#simplified a.php b.php
[ab].php
#Matching rules are the same as linux file matching
#Start with a slash "/" to indicate a directory;
#Use an asterisk "*" to wildcard multiple characters;
#Use a question mark "?" to wildcard a single character
#Use square brackets "[]" Contains a matching list of single characters;
#Exclamation mark "!" indicates that the matched files or directories are not ignored (tracked)