Congrats!

SSH is set up to start pushing to a remote repo.

There are certainly good, recommended practices such as creating feature branches or specific branches for working on and version controlling your project in efficient bit size chunks. That will be discussed in another post.

For now, I am going to jump right in and share pushing new code to the remote repo.

Let us say, that the new repos was cloned, but since it's new it's empty and will look like this:

my-project/
└── .git/

Now let's say a new directory for the source code has been added with a file that holds the code.

my-project/
├── .git/
├── src/
   └── main.py

There are now three commands to be ran in succession to push this newly added directory containing the code file to the remote repo.

1. git add .

Run the following command: git add .

This command will stage all changes in the current directory and subdirectories.

2. git commit -m ""

First what is a commit? This is essentially a snapshot of yoru projects state at a particular point in time. This includes any added, modified or deleted files.

The -m flag stands for message, allowing you to write a description in the "" in line with the command of the changes beng made. Otherwise a text editor would be summoned. The message is key not only for one's self but for collaboration purposes as well.

Run git commit -m "Description of changes."

Commits allow you to keep track of every change that occurs in your project. Making it easier to manage versions, roll backs, and collaborating with others.

3. git push -u origin main

When the new repo was created, an option was given to call the primary branch main or master. They are both funtionally the same. The modern naming convention is main, this post is going to roll with that.

After running the command to commit your project, it is now possible to push to the remote repo.

Run git push -u origin main

Breaking this down:

It is to be noted again that this command pushes the main branch to the origin remote and sets it as the default tracking branch for future pushes.

For future pushes you can run git push .