git command
connet to uoft server from pycharm
settings –> SSH Configurations –> add one
| 1 |  | 
–> Test Connection
Then, go to the Terminal. There is a drop-down list. Choose the ssh server you just added. Then you are connected to the server.
push a folder
If there is a local folder in your laptop and you want to push it into a github repository.
- first, build a new repository in your github account
- copy the ssh this new repository
- (local folder) git bash1 
 2
 3
 4
 5
 6
 7
 8$ git init
 $ git remote add origin git@github.com:freya-popo/csc2529-hw3.git # connect the local folder to the github repo
 $ git pull origin master # pull the github repo to local repo, keep align
 $ git add . # add files to the local repo
 $ git commit -m "first push" # commit files to local repo
 $ git push origin master # push the local repo to the github repo
 # if the file is in the previous folder which has been connected to the github repo, only the last 3 steps need to be done
delete files from the github repo
| 1 |  | 
push files from a server
In this assignment, I want to use a remote server to run a python program.
First of all, ssh to the server.
Then clone the github repo
| 1 |  | 
After running the python program, I got a new picture and wanted to upload this picture to the github repo.
| 1 |  | 
The files is in the server’s local repo now. But I got an error when I pushed them by this command.
| 1 |  | 
I think it is because the user is changed and I need to use a new token.
So, I need to generate a new token from my github account.
Settings –> Developer Settings –> Personal access tokens –> Tokens(classic) –> generate new token –> generate new token (classic)
tips: remember to select appropriate scopes or another error will occur.
| 1 |  | 
Then we got the token, copy the token and run the push command again:
| 1 |  | 
Then you can see the new files in the github repo.