STEP1: Initialize git into your current working repository
mkdir sample
cd sample
git init
echo "# AuthVault" >> README.md
git add README.md
git commit -m "first commit"
STEP2: Set name and email address
Option 1: Set it globally (recommended for your personal computer)
git config --global user.name "Your Real Name"
git config --global user.email "your-real-email@example.com"
Option 2: Set it only for this specific repository (if you don’t want it global)
git config user.name "Your Real Name" # for example: "John Doe"
git config user.email "your-real-email@example.com"
git commit -m “first commit”
STEP3: Create a new remote, name it “origin”
– Adding the location of your remote repository where you wish to push/pull your files to/from
- Your remote repository could be anywhere on github, gitlab, bitbucket, etc.
-
Here origin is an alias/alternate name for your remote repository so that you don’t have to type the entire path for remote every time and henceforth you are declaring that you will use this name(origin) to refer to your remote. This name could be anything.
-
To verify that the remote is set properly type : git remote -v
git remote add origin git@github.com:Github_User/Repo_Name.git
STEP 4:
create a branch, for Giblab, default is “main”
git branch -M main
pull from remote
git pull origin main
Username for 'https://github.com': xxxx@gmail.com
Password for 'https://xxxx@gmail.com@github.com':
remote: Invalid username or token. Password authentication is not supported for Git operations.
fatal: Authentication failed for 'https://github.com/???/xxxx.git/'
Option 1: Use a Personal Access Token (HTTPS)
1.Go to GitHub → Settings → Developer settings → Personal access tokens
2.Click “Tokens (classic)” → Generate new token → choose:
- repo scope (for private repos),
- set expiration (e.g. 90 days).
3.Copy the token (you won’t see it again).
4.when Git asks for your password during git pull or git push:
- Username = your GitHub username
- Password = the token you just created
Or you can store it like this:
git remote set-url origin https://<USERNAME>:<TOKEN>@github.com/???/xxxx.git
Option 2: Use SSH Keys (Recommended)
1.Generate SSH key (if you don’t have one yet):
ssh-keygen -t ed25519 -C "your_email@example.com"
Press Enter to accept defaults.
2.Add the key to your SSH agent:
Linux:
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
cat ~/.ssh/id_ed25519.pub
Copy the public key.
Windows:
- Press Win + R → type services.msc → Enter
- Find OpenSSH Authentication Agent → right-click → Properties → Startup type: Automatic → Start the service → OK
ssh-add ~/.ssh/id_ed25519
Identity added: /c/Users/YourName/.ssh/id_ed25519 (your-email@example.com)
type id_ed25519
Copy the public key.
4.Go to GitHub → Settings → SSH and GPG keys → New SSH key, paste it.
5.Change your repo’s remote URL to use SSH:
git remote set-url origin git@github.com:???/xxxx.git
6.Test it:
ssh -T git@github.com
7.Now git pull origin main and git push origin main will work without typing tokens.
STEP 5:
add some files
echo "# MESSAGE" >> README.md
git add README.md
git commit -m "first commit"
STEP 6:
git push -u origin master
- Pushes your files to the remote repository.Git has a concept of something known as a “branch”, so by default everything is pushed to the master branch unless explicitly specified an alternate branch.
- To know about the list of all branches you have in your repository type :git branch
Error:
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Writing objects: 100% (3/3), 229 bytes | 229.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
remote: error: GH007: Your push would publish a private email address.
remote: You can make your email public or disable this protection by visiting:
remote: https://github.com/settings/emails
To github.com:sophon-labs-ai/AuthVault.git
! [remote rejected] main -> main (push declined due to email privacy restrictions)
error: failed to push some refs to 'github.com:sophon-labs-ai/AuthVault.git'
some commands:
Force the correct noreply email just for this repository
git config user.email "sophon-labs-ai@users.noreply.github.com"
delete a branch
git push origin –delete
#show all remote and local branches
git branch -a
“`