Use Git in Pycharm to realize remote upload

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
Please add a picture description

After clicking Create, a secret key will be generated for local connection Please add a picture description
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 Please add a picture description
clone the files and the remote git library The same as the file (this .git is a hidden file)
insert image description here

2. Create a new python project

Let's create a few files at will

Please add a picture description
At this time, our project is not abnormal, and the following operations will make changes
insert image description here
insert image description here

3. Copy the cloned file to the python project

insert image description here

At this time we return to pycharm, some icons have changed
insert image description here

insert image description here
At this time, the red file indicates that it has not been submitted
insert image description here

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
insert image description here
and select all the files. The √ on the right can be canceled. Fill in the submission comments below and click Submit.
insert image description here
Method 2:
Just use the command method, you can use the command in the Terminal in pycharm to submit
insert image description here
and check the file status, indicating that it has entered the cache.
insert image description here
After the submission, the project file turns green and
insert image description here
then submitted to the local git warehouse
insert image description here
and then submitted to the remote, so that Entered our remote git warehouse insert image description here
to view the information of the remote git warehouse
insert image description here

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)

This is the first time I write, I have no experience, please enlighten me if there are mistakes, and make progress together.

Guess you like

Origin blog.csdn.net/qq_40529151/article/details/119904972