Find who added a file to git repo

git

To find which user and when a file gets committed to a git repository, you can use the command git log –diff-filter=A — FILE_NAME_HERE For example boby@sok-01:~$ git log –diff-filter=A — global_evildoer.php commit 263f547cecba129b14faeb412b33ef43c678cced Author: php user Date: Fri Nov 18 23:27:01 2022 -0800 brunch changes boby@sok-01:~$ Back to git

Color git command line result

On CentOS, when i run git commands like “git status” or “git diff”, the result is shown with out any color. On Ubuntu, git always show result in color. To make git result show in color, edit file vi ~/.gitconfig Add [color] diff = auto status = auto branch = auto interactive = auto ui … Read more

Show git branch in terminal

show git branch in terminal

When working with git, to avoid accidental commit to wrong branch, it will be better if terminal show the branch name you are currently in. To display “git branch” in terminal, edit .bashrc vi ~/.bashrc Add following code to end of the file. # Show git branch in command promt if git repo show_git_branch() { … Read more

Auto push after git commit

Git hook allow you to perform tasks when some changes happen on a git repository. To automatically push code when you make a commit, create hook file .git/hooks/post-commit vi .git/hooks/post-commit Add #!/bin/sh git push origin master Thats all. Unlike normal bash scripts, git hooks don’t need 755 permission to run. Example [root@lin vshare]# cat .git/hooks/post-commit … Read more

Enable SSL on BitBucket Server

bitbucket server

BitBucket Server alloow you to host git repositories. By default bitbucket server have url in following format http://YOUR_IP_ADDR:7990/login To install SSL, first point a domain to the server IP. Install nginx apt install nginx Now install LetsEncrypt wget https://raw.githubusercontent.com/serverok/server-setup/master/install/letsencrypt.sh bash ./letsencrypt.sh Get SSL in standalone mode. We use standalone mode because nginx will proxy all … Read more

Git Ignore file Permission (chmod)

Git SCM

Some times when you transfer file to web server, you may need a differnt file permission for files to run in web server, if your code is in git, this make the files marked as modified eventhough file contents are the same. To avoid git checking for file permission (chmod), run following command git config … Read more

Git stdin is not a tty

When i push to get respo, i get error stdin: is not a tty Other than this error on push and pull, everything worked fine. SOLUTION 1 Add following to top of file /home/git/.bashrc if [ $(expr index “$-” i) -eq 0 ]; then return fi Modified .bashrc on my server root@server70 [~]# cat /home/git/.bashrc … Read more

How to protect .git folder using htaccess

GIT is popular version control software, this work like a time machine. You can easily get older versions of code. Each changes are stored as commit, so it work like a time machine for source code. If you put your .git folder in a publically accessable folder, others will be able to access your source … Read more

Git

Monitor file changes in your Website PHP Script to pull changes from GIT Repository How to protect .git folder using htaccess Git stdin is not a tty Git Ignore file Permission (chmod) Show git branch in terminal Color git command line result How to block .git directory in nginx Find who added a file to … Read more

git log

To see got commit log, type git log To see logs in one line, run git log –oneline To see one line grap, use git log –oneline –graph or git log –oneline –graph –decorate git