git & gitHUB

  • Git & GitHub Things

1.  git init //to initialize the git in the folder

2. git remote add origin https://github.com/luciferdk/01JS.git  || git clone https://github.com/luciferdk/01JS.git //to initialize the github in the local folder

  •  git pull origin master //to verify your project is righ to setup if you remotely add Origin
  •  git merge master //if you remote add the origin

3.   git add -A || git add .  // to add the file in stazing area

4.  git commit -m "meaningfull-message" //now your code is in statizing area.

5.   git pushgit push -u || git push origin master  //to push all the git code in your GitHub

6.  git -rm --cached .  //to unstated all commit  dot. is repesent all file will unstaged

      git push origin HEAD:main   //after changing  branch name you might need this code to push repo

==============================================================

create a new repository on the command line


echo "# week7.1.js_router" >> README.md

git init

git add README.md

git commit -m "first commit"

git branch -M master

git remote add origin git@github.com:luciferdk/week7.1.js_router.git

git push -u origin master  ||  git push origin master


==============================================================

or push an existing repository from the command line

git remote add origin git@github.com:luciferdk/week7.1.js_router.git

git branch -M master

git push -u origin master


 

====================================================================== 


git set up first time

  1. cd ~     //first go root directory
  2. git config --global user.name "ldk"  //set your user name
  3. git config --global user.email "idk@gmail.com"  //set your user email
  4. git config --list || git config --list --global  //verify your credential data is righ or not 

6. ssh-keygen -t ed25519 -C "your_email@gmail.com"  //this will generate new ssh-key

7. cat ~/.ssh/id_ed25519.pub | clip //this will copy your git ssh key into your clipbord

8.  ssh -T git@github.com  //check ssh code working or not

9. git branch //to check how many branch in your git

10.  git checkout //to switch branch

11.  git branch -M main master     //this will use to change the branch name

12.  git branch --delete <branchname> //to delete the branch when you delete don't present in that directory

13.  git checkout -b branchName //make a new branch and same time you will got switch that brnach

14. (use "git restore --staged <file>..." to unStage)

 

this is my ssh key

ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBDlu0kME/vclcKm/QPVNIxXb82W96lQu5qERGnRJhKO dksinha0701gmail.com

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

alternate email given by github to hide your email

124131133+luciferdk@users.noreply.github.com



=========================================================================


.  before pushing your git feature1 branch on github feature1 branch first create your feature1 branch on git hub then push it

.  git checkout -b [branchName] //make a new branch on git, and same time you will got switch that brnach

.  git push origin [branchName] //if you make features1 branch on git and you want to push your code into features1 branch github use this code simply

git remote -v //to check remote origin 

git remote remove origin //to remove remote origin if mistakliy set


git branch    //to see which branch youare on stand

git checkout [branchName]    /to switch branch name

git status    //to know your status

rm -rf .git  // uninitiated your project with git

note*  if you clone your code then you dont need to inislize your git through git init


=========================================================================


You can remove your Gmail address and username from Git configurations in two ways:

1. Using a text editor:

  • Open your terminal and navigate to your Git repository using cd.

  • Run the following command to open the Git configuration file in your default text editor:

    Bash
    git config --global --edit
    
  • This file contains configuration settings related to your username and email.

  • Locate the lines that start with user.name and user.email. They will look something like:

    user.name = Your Name
    user.email = your_email@gmail.com
    
  • Delete these lines entirely or comment them out by adding a # symbol at the beginning of each line.

  • Save the changes in your text editor.



2. Using a command-line option:

  • Open your terminal and navigate to your Git repository.

  • To completely remove the username and email configurations, run these commands:

    Bash
    git config --global --unset user.name
    git config --global --unset user.email
    

==========================================================================








Comments

Popular posts from this blog

CyberSecurity

VERTICAL SCALING 💋

prisma using in project idx 13.3