github

GitHub

GitHub is a software development platform in the cloud. It's used for storing, tracking, and collaborating on software projects.

GitHub users create accounts, upload files, and create coding projects. But the real work of GitHub happens when users begin to collaborate.

GitHub CLI

winget install --id GitHub.cli

Personal access tokens (classic): Tokens you have generated that can be used to access the GitHub API.

Once CLI gh is intalled then you log in via console ...

first, we create a repo on github.com, and then we clone it on local ...

gh repo clone AlbertProfe/testreact

git status

and create one document, doc1.txt

git commit -m "first message"

git push

and we check out on cloud, https://github.com/AlbertProfe/testreact, that doc1.txt has been pushed.

gh auth logout

gh auth logout [flags]

Remove authentication for a GitHub host.

This command removes the authentication configuration for a host either specified interactively or via --hostname.

create a new branch and change HEAD to new branch


git branch newfeature

git checkout newfeature

git push origin newfeature

git push --set-upstream origin newfeature

(1) we do a git pull request on github.com and then (2) on remote, main and new feature (remote > local) git pull

What is Git remote?

Git remote discussion

Git is designed to give each developer an entirely isolated development environment. This means that information is not automatically passed back and forth between repositories. Instead, developers need to manually pull upstream commits into their local repository or manually push their local commits back up to the central repository. The git remote command is really just an easier way to pass URLs to these "sharing" commands.

The origin Remote

When you clone a repository with git clone, it automatically creates a remote connection called origin pointing back to the cloned repository. This is useful for developers creating a local copy of a central repository, since it provides an easy way to pull upstream changes or publish local commits. This behavior is also why most Git-based projects call their central repository origin.


In Git, what is the difference between origin/master vs origin master?

There are actually three things here: origin main is two separate things, and origin/main is one thing. Three things total.

Two branches:

  • main is a local branch

  • origin/main is a remote tracking branch (which is a local copy of the branch named "main" on the remote named "origin")

One remote:

  • origin is a remote

We also may fork from production to dev, work features on dev and then pull request back to production. (1)

Fork github.com: Fork > Create new fork (from albertprofe repo on alberprofedev account)

git-sync is used for syncing a fork with the upstream repository the fork was created from. (1)

contribute is used to submit pull requests to with the upstream repository the fork was created from by offering your changes up to the original project. (1)

From local to cloud

Create your repo on GitHub and then.. push your code to the GitHub.com cloud (or clone it).

git init

git add .

git commit -m "first commit"

git branch -M main

git remote add origin https://github.com/albertprofe/mychat.git

git repo clone https://github.com/albertprofe/mychat.git

git push -u origin main

and then deploy React App to GitHub Pages, (1)

Cloud CD/CD devOps: