How to publish to GitHub when in school
Go Home
I haven't yet created a GitHub repo
- Create a new repository on Github.
- If you don't have a terminal open in your IDE, open one.
For VS Code: Press Ctrl + ' or click View --> Terminal.
For PyCharm: Press Alt + F12 or the Terminal button in the bottom right.
- When you have a terminal open, run
git init | git config --global user.name "YOUR NAME" | git config --global user.email "YOUR GITHUB EMAIL" | git add . | git -c http.sslVerify=false commit -m "COMMIT MESSAGE" | git -c http.sslVerify=false branch -M main | git -c http.sslVerify=false remote add origin https://github.com/GITHUB_USERNAME/REPO_NAME.git | git -c http.sslVerify=false push -u origin main
- From now on, each time you want to publish to GitHub, commit as normal from the sidebar, and
git add . | git -c http.sslVerify=false commit -m "COMMIT MESSAGE" | git -c http.sslVerify=false push -u origin main in the terminal.
I have already created a GitHub repo
- Open up a terminal window by pressing Ctrl + ', or by going to View and clicking Terminal.
- If there is already code in the repository, run this command:
test.
If there is no code in the repository, run this command: test.
- Initialise repository as normal from sidebar menu.
- Do some code, type in a commit message, and click Commit.
- If you get an error saying you need to "Make sure you configure your "user.name" and "user.email" in git.", run
git config --global user.name "Your Name" | git config --global user.email "your@email.com" in the terminal and try to commit again. If no terminal is open, click on View in the top left, click on Terminal, and then you will be able to run the command.
- Click "Publish Branch". You will be prompted to log into GitHub. Follow the steps to log in, and return to VS Code. If the Login fails, follow the instructions in the bottom right to try to log in. Once logged in, continue.
- Run
git init | git add . | git -c http.sslVerify=false commit -m "first commit" | git -c http.sslVerify=false branch -M main | git -c http.sslVerify=false remote add origin https://github.com/USERNAME/REPO_NAME.git | git -c http.sslVerify=false push -u origin main in the terminal.
- If no terminal is open, click on View in the top left, and click on Terminal.
- If you are get the error that "remote origin already exists", run
git remote remove origin, and re-run the above command.
- You should be prompted again to log into GitHub. Follow this. You may get some sort of connection error or blank window in your browser. Ignore and close this, and return to VS Code.
- You should now have published to your already existing repo.
- From now on, each time you want to publish to GitHub, commit as normal from the sidebar, and run
git -c http.sslVerify=false push -u origin main in the terminal.
yeah just add this when you can git add . | git -c http.sslVerify=false commit -m "test stuff" | git -c http.sslVerify=false branch -M main | git -c http.sslVerify=false push -u origin main (commit after first time)