Github now allows for private repository. Even though it has certain limit, e.g., size of the repo, it gives more options to the developers. Below are a few notes on Github.
Question: How to push a local commit to your repository hosted on Github?
If you don’t have an SSH key pair already, create one with the command below and replace “your_email@example.com” with your actual email registered with Github. If you prefer to create a passphase for the SSH key, create one. Otherwise, leave it blank.
ssh-keygen -t ed25519 -C “your_email@example.com”
The public key should be in the ~/.ssh/ folder as id_ed25519.pub. Add this key to your Github account and specify it as the authentication key. To test your SSH connection to Github, run this.
ssh -T git@github.com
Create a new private empty repo on Github and write down its path, for example, your_user_name/new_repo.git. Alternatively, you might use gh – the Github CLI tool.
Add the remote repository to your origin (on the local machine) using Git Bash (in a single line)
git remote add origin git@github.com:your_user_name/new_repo.git
To verify if the remote URL has been set properly, run the following command (or check the file .git/config).
git remote -v
Now you could push the local commits to the remote repo using the command below, assuming the branch name is main. If your remote repo is ahead of your local repo as far as commit is concerned, you might delete your local folder and then clone the remote repo on Github
git push origin main
Question: How to copy or clone a remote repo on Github to your local machine?
git clone git@github.com:your_user_name/new_repo.git
More resources could be found at https://cli.github.com/manual/
If you want to remove and reconfigure the origin of the Github repo, you could do this.
git remote remove origin