Python 3home |
git may already be installed, or may need to be installed.
First, check to see if git is available. At the Terminal or Command Prompt window, issue this command:
git --version
If you see a version number, then git is installed. If not, you may need to install it. On later Mac computers, the above command may conclude with a prompt offering to install the Mac Command Line Developer Tools. These tools include git, so this is the easiest way to install from a mac. However, if you see a message that indicates an error or problem, this means taht git is not installed. See next slide.
On Mac: If git --version was not found, but did not prompt you to install git, then you must install it.
On a Mac it is easiest to install the Xcode Command Line Tools. In your open Terminal window, type this command and hit [Enter]:
xcode-select --install
On PC: please visit https://git-scm.com/download/win and download the git installer .exe file. Doubleclick and follow the prompts. Please note that these instructions are new, so let me know if you run into any issues.
A repository is used to house a codebase.
A codebase refers to the code and supporting files that make up the software projects for a company or for a team, or may refer to a single software project or module, or the code being developed by an individual. A codebase could be developed over the course of years by a number of individuals. A code repository is a program that stores copies of the files in the code base and keeps track of the changes (deltas) that are made to them over time. It is possible to look back to how a given file looked at any previous date, and restore that file to a previous state, as desired. The repository also can manage changes to a code base that may be made by multiple participants -- it then allows those changes to be merged together; in this way it is an excellent collaboration tool. To create a new repository on github.com:
Github creates your project and lands you on the project page, with the name near the top left.
The "secure shell" (ssh) protocol allows us to validate a user, similar to a password.
"ssh keys" refer to a private key + public key arrangement -- the private key is held by the user, and the public key is placed on the server. Only holders of the private key will have access to the account.
Under this encryption scheme, the server can validate this user using the public key, but the public key cannot be used to generate a private key, so it remains secure with the user.
A. Generate a new ssh key pair.
(base) david@192 ~ % ssh-keygen -t ed25519 -C "your_email@example.com"
The ed25519 key type is recommended by github.Your identification has been saved in /Users/david/.ssh/id_ed25519 Your public key has been saved in /Users/david/.ssh/id_ed25519.pub
(base) david@192 ~ % cat /Users/david/.ssh/id_ed25519.pub
C:\Users\david> type C:\Users\david\.ssh\id_ed25519.pub
"Cloning" connects a folder on your local machine to the repo on the server.
A. At the terminal, create a new directory to hold your github repo(s); cd into that directory. 'repos' is a reasonable name; you can also call it something convenient to you.
(base) david@192 ~ % mkdir repos # (where projdir is the name of your repository) (base) david@192 ~ % cd repos (base) david@192 repos %
(base) david@192 repos % git clone git@github.com:davidostest/demo_20230808.git
If this is the first time connecting to git, git responds with the following prompt:
Cloning into 'demo_20230808'...
The authenticity of host 'github.com (140.82.113.4)' can't be established.
ECDSA key fingerprint is SHA256:p2QAMXNIC1TJYWeIOttrVc98/R1BUFWu3/LiyKgUfQM.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Type yes and hit [Enter]. This creates a special .git directory here. You'll see a message to this effect.
(base) david@192 repos % ls demo_20230808 (base) david@192 repos % cd demo_20230808 (base) david@192 demo_20230808 % ls README.md