Git Init: Dddddddssssopen Gitbash Create A New Repository Using Mkdir Command For Github, Gitrepos, and Titan
Git Init: Dddddddssssopen Gitbash Create A New Repository Using Mkdir Command For Github, Gitrepos, and Titan
Create a new repository using mkdir command for github, gitrepos, and titan
Git Init
The git init command is the first command that you will run on Git. The git
init command is used to create a new blank repository. It is used to make
an existing project as a Git project. Several Git commands run inside the
repository, but init command can be run outside of the repository.
The git init command creates a .git subdirectory in the current working
directory. This newly created subdirectory contains all of the necessary
metadata. These metadata can be categorized into objects, refs, and
temp files. It also initializes a HEAD pointer for the master branch of the
repository.
The git init command creates a new Git repository. It can be used to convert an existing,
unversioned project to a Git repository or initialize a new, empty repository. Most other Git
commands are not available outside of an initialized repository, so this is usually the first
command you'll run in a new project.
Whenever creating a new repository use git init command
After running git init command we can see that “.git” repository is created
After doing git init command for the directory that will be master branch
The above command will create a new subdirectory named .git that holds all
necessary repository files. The .git subdirectory can be understood as a Git
repository skeleton. Consider the below image:
An empty repository .git is added to my existing project. If we want to
start version-controlling for existing files, we have to track these files with
git add command, followed by a commit.
1. $ git status
In the above output, the list of all untracked files is displayed by the git
status command. To learn more about status command, visit Git Status.
Again run git commit with login it will not show any error
Now its all files added to commit and now it’s a tracked files.
We doesn’t insert any files
Steps:-
1. Set the name and email for git to use when you commit:-
Git config –global user.email [email protected]
Git config –global user.name “manobrock”
2. Create a directory
3. Initialize dir with
Git init
4. Create Readme.md file
Git add (Staging)
Git commit (Local Commit)
5. Create Remote repository on
Github, bitbucket, codecommit etc
6. Clone repo to local
Git clone url
7. Local to Remote integration
Cd to local repo
Git remote add origin
Ssh://[email protected]/[username]/[repository-name].git
Git push
Git pull (to fetch latest changes)
Github introduction
We can create a repository using command line with the below steps
If we having existing repository follow the below steps with the help of command line
And paste in the github and run the command cat .git/config
when you run this command git push this will change will happen on
github from the local repository its synching local repository to
remote repository for that we need authentication
Our changes pushed from local to remote we can see that after refresh
Now check with git status it will show modified file with time
Now iam going to add the file using “git add Neptune1.py”
Post that use git commit command
Now its committed successfully but its done in locally not remotely
If you are feeling commit id is very long then use this “git log --oneline” command, so that commit id
will be short instead of long.
Whenever we make the changes Eg: some line is removed some line is added that will show in both
command line as well as git hub site. If removed it will show in red color and if we add it will show in
green color.
1. Git add .
2. Git commit “commit message”
3. Git push origin main
4. Git log –oneline
5. Git show commit_id
If you want to pull the latest changed using the “git pull” command
Now I am creating a new branch thru local repository using the below command
For remove use git rm it will remove the file and also from the index and staging area
I want to merge with main from sprint1 temp branches use the below command
Git merge sprint1 (sprint 1 changes will merge with main branch)
If you going to merge with master branch or any other branch you should be in that branch
Git push -all origin (Already we pushed all the files to remote repository so that its showing
message as everything up to date)
Rm -rf titan
Run git diff command see the difference what lines added or removed
I am going to commit some changes. Suddenly observed that I don’t want that changes we use git
restore –staged filename
Use this git revert HEAD commitid (which commitid you want to go)
git revert HEAD 5a9327b
Observed that we don’t have any pluto file because we reverted pluto changes
If you don’t want to store anything on history use the below command
Cat .git/config
This is not a right way to login with git ssh
Ssh-keygen.exe
Give the title like project suitable name and paste only public key and click on add SSH Key
Now added public ssh key
If public key matches with private key, then it will clone successfully
To add a new remote, use the git remote add command on the terminal, in the directory your
repository is stored at.
2. Open github
https://github.com/ManojYajendrababu/jenkinstriggers.git
Go to settings->developer settings
Click on the fine-grained tokens
Click on generate new token and do some config and click on generated new token
https://www.youtube.com/watch?v=uFaYgSVzy3w