Buy Me a Coffee

[Git] Unable access xxx: Is a directory

When I run git status, it shows the below error warning: unable to access '/etc/gitconfig': Is a directory warning: unable to access '/etc/gitconfig': Is a directory warning: unable to access '/etc/gitconfig': Is a directory The solution is to remove /etc/gitconfig. The target /etc/gitconfig might be varied from each case. With the below command, all can be solved. sudo rmdir /etc/gitconfig The reason that the problem suddenly pops up is because I ran a experiment docker command something like docker run --rm -v /etc/gitconfig:/etc/gitconfig ..... So the /etc/gitconfig is created. ...

[Git] Error: remote rejected (permission denied)

The error pop up When I pushed the changes on a new branch for the first time. ! [remote rejected] oscar-next -> oscar-next (permission denied) error: failed to push some refs to 'https://github.com/oscarzhou/portainer.git' The solution is to update the git config like below git config --local --list # old config remote.origin.url=https://github.com/oscarzhou/bar.git # update new config with git config remote.origin.url https://foo%40gmail.com@github.com/oscarzhou/bar.git After that, we can run git push --set-upstream origin <branch_name> ...

[Git] Fatal: this operation must be run in a work tree

fatal: this operation must be run in a work tree The error pop up while running git status. The solution is to change the repository not bare mode git config core.bare false

[Git] How to rebase the pushed branch

Learning the knowledage with a real case is always perferred. I met a case today that I need to use git rebase --interactive to solve the issue. The story is that my colleague created a branch for doing some research one year ago. Let’s say the branch name is feat/performance-research. As the branch is mainly for research purpose, it was not merged to the master branch at that time. However, some changes and results were quite valuable. ...

[Axios] How to extract header data in Axios response interceptor

Let me give an example first. Frontend sends an API request, and server will reject it and add a reason of the rejection into the response header. In this scenario, Frontend wants to extract the reason from the header in the response interceptor and then navigate to different page depending on the reason. The code is very straightforward like below. 1export function errorInterceptor(error: AxiosResponse) { 2 if (error.status === 401) { 3 const reason = error.headers['reason']; 4 if (reason === 'bar') { 5 window.location.href = '/#!/foo'; 6 } 7 } 8 return Promise.reject(error); 9} 10 11axios.interceptors.response.use( 12 (response: AxiosResponse) => response, 13 errorInterceptor 14); Unfortunately, the above code will behave unexpectedly. As the highlight code error.headers['reason'] will be undefined. ...

[Linux] Error: ENOSPC: System limit ...

I can do general frontend work, but I’m not specialized in front end. Today when I run up the front-end project, I met the following issue. Error: Watchpack Error (watcher): Error: ENOSPC: System limit for number of file watchers reached... The reason is that there is restriction of opening files by one process in Linux. The default number of opening file might be too limited especially when you run with webpack. The solution is to increase the limitation. You can change as below. ...

[Ubuntu] How to mount the external hard drive permanently

I will introduce this topic with a real example. The scenario is that I have two external NTFS hard drives. I want them to behave like the partition on Windows, like D drive, E drive something. However, every time when the Ubuntu is rebooted, those two hard drives are mounted to the path /media/<username>/<label name> and they are read-only. I wrote a temporary solution for the above issue, but it stil requires to execute the command every time when PC boots. This post will give a one-go solution. ...

[Ubuntu] External hard drive is read-only

Yesterday I installed Ubuntu on my PC, but I met an issue about the external drive is always the read-only. As the hard drive was the destination of my internal minio server, so I have make it writable too. Error: mkdir: cannot create directory ‘abc’: No such file or directory When I ran the df -T, it shows like /dev/sdb2 fuseblk 3907000316 278934580 3628065736 8% /media/username/InternalBackup I labelled the hard drive name as InternalBackup in the Windows OS before. ...

[microk8s] Troubleshooting Microk8s Installation on macOS

Error: Your Command Line Tools are too outdated By following the instruction from the official website Alternative install methods: macOS, I got an error while running brew install ubuntu/microk8s/microk8s as shown below As the prompt suggested, I installed the latest Xcode from the AppStore. (It took quite long to be honest). But it still showed the same error after updating the Xcode to the 13.2.1 The trick is that we should run the following commands: ...

[Git] How to work with remote repository (with example)

When we manage and maintain a public github repository, it is common to see a case that a fixed branch from outside contributor’s is staled. The reasons can be The github repository owner/maintainer and contributor did not actively process the issue in time. The contirbutor only commited the changes in his branch but didn’t make a pull request, and after a period, he is not reachable. Other reasons… Overall, it is not easy to maintain a public github repository, especially the one with lots of stars. This post will show a way to solve the above issue with a git feature. ...

DigitalOcean Referral Badge
Sign up to get $200, 60-day account credit !