Initial Project
git init
git add .
git commit -m "Initial commit"
git remote add origin <repository-url>
git push -u origin masterGit Configuration
As you read briefly in Getting Started, you can specify Git configuration settings with the git config command. One of the first things you did was set up your name and email address:
git config --global user.name "AvN Learn"
git config --global user.email avnlearn@gmail.com
git config --list --show-origin
git config --global core.editor nvim
git config --global init.defaultBranch mainNow you’ll learn a few of the more interesting options that you can set in this manner to customize your Git usage.
update
git branch -M mainAdd remote
git remote add origin git@github.com: avnlearn/manim-recorder.gitUpdate
git push -u origin maingit push -f origin mainClone
git pullConnect SSH
Step - 1 : Generating a new SSH key
You can generate a new SSH key on your local machine. After you generate the key, you can add the public key to your account on GitHub.com to enable authentication for Git operations over SSH.
ssh-keygen -t ed25519 -C "avnlearn@gmail.com"Step - 2 : Adding your SSH key to the ssh-agent
Before adding a new SSH key to the ssh-agent to manage your keys, you should have checked for existing SSH keys and generated a new SSH key
Step - 2.1 : Start the ssh-agent in the background.
eval "$(ssh-agent -s)"Depending on your environment, you may need to use a different command. For example, you may need to use root access by running sudo -s -H before starting the ssh-agent, or you may need to use exec ssh-agent bash or exec ssh-agent zsh to run the ssh-agent.
Step - 2.2 : Add your SSH private key to the ssh-agent.
If you created your key with a different name, or if you are adding an existing key that has a different name, replace id_ed25519 in the command with the name of your private key file.
ssh-add ~/.ssh/id_ed25519Step - 3 : Adding a new SSH key to your account
You can add an SSH key and use it for authentication, or commit signing, or both. If you want to use the same SSH key for both authentication and signing, you need to upload it twice.
After adding a new SSH authentication key to your account on GitHub.com, you can reconfigure any local repositories to use SSH. For more information, see
Step - 4 : Adding a new SSH key to your account
You can add an SSH key and use it for authentication, or commit signing, or both. If you want to use the same SSH key for both authentication and signing, you need to upload it twice.
After adding a new SSH authentication key to your account on GitHub.com, you can reconfigure any local repositories to use SSH. For more information, see Managing remote repositories.
Note: GitHub improved security by dropping older, insecure key types on March 15, 2022.
As of that date, DSA keys (
ssh-dss) are no longer supported. You cannot add new DSA keys to your personal account on GitHub.com.
RSA keys (
ssh-rsa) with avalid_afterbefore November 2, 2021 may continue to use any signature algorithm. RSA keys generated after that date must use a SHA-2 signature algorithm. Some older clients may need to be upgraded in order to use SHA-2 signatures.
Step - 4.1 : Copy the SSH public key to your clipboard.
If your SSH public key file has a different name than the example code, modify the filename to match your current setup. When copying your key, don't add any newlines or whitespace.
$ cat ~/.ssh/id_ed25519.pub
# Then select and copy the contents of the id_ed25519.pub file
# displayed in the terminal to your clipboardTip: Alternatively, you can locate the hidden .ssh folder, open the file in your favorite text editor, and copy it to your clipboard.
- In the upper-right corner of any page on GitHub, click your profile photo, then click Settings.
- In the "Access" section of the sidebar, click
SSH and GPG keys. - Click
New SSH keyorAdd SSH key. - In the "Title" field, add a descriptive label for the new key. For example, if you're using a personal laptop, you might call this key "Personal laptop".
- Select the type of key, either authentication or signing. For more information about commit signing, see "About commit signature verification."
- In the "Key" field, paste your public key.
- Click Add SSH key.
Example (Step)
ssh-keygen -t ed25519 -C "avnlearn@gmail.com"
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
cat ~/.ssh/id_ed25519.pubShort Notes
create a new repository on the command line
echo "# avnlearn" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin git@github.com:avnlearn/avnlearn.git
git push -u origin mainpush an existing repository from the command line
git remote add origin git@github.com:avnlearn/avnlearn.git
git branch -M main
git push -u origin main
Join the Discussion