Category Archives: Linux

[Solved] (gnome-ssh-askpass:609): Gtk-WARNING **: cannot open display:

As the title, remote login to the Linux server, execute

git clone https://git.oschina.net/chenjianlong/JRoll2.git

//error
(gnome-ssh-askpass:609): Gtk-WARNING **: cannot open display:

Solution 1:

unset SSH_ASKPASS

Then enter the password

The reason is that the HTTPS protocol is used, and the password is required for each submission. If the GIT command is executed automatically by shell, the script will be interrupted and cannot be executed

Solution 2: Using SSH

Method reference for generating SSH: git on server – generate SSH public key

git clone [email protected]:chenjianlong/JRoll2.git

You only need to confirm the SSH link once

[Solved] Git pull fatal: refusing to merge unrelated histories

1. First I have a remote repository in github, then I have a local repository

I added a new file to my local repository, and then after I associated it (git remote add origin [email protected]:qshilary/gittest.git)

2. Git push found an error

eqiasui@CN00214190 MINGW64 ~/Documents/practice (master)
$ git push origin master
Warning: Permanently added the RSA host key for IP address ‘13.250.177.223’ to the list of known hosts.
fatal: remote error:
is not a valid repository name
Email [email protected] for help

eqiasui@CN00214190 MINGW64 ~/Documents/practice (master)
$ git remote add origin [email protected]:qshilary/gittest.git
fatal: remote origin already exists.

eqiasui@CN00214190 MINGW64 ~/Documents/practice (master)
$ git push origin master
fatal: remote error:
is not a valid repository name
Email [email protected] for help

3. Then I found that Git remote -v was indeed associated, and then I needed to delete and re-associate it

eqiasui@CN00214190 MINGW64 ~/Documents/practice (master)
$ git remote -v
origin [email protected]:qshilary/[email protected]:qshilary/gittest.git (fetch)
origin [email protected]:qshilary/[email protected]:qshilary/gittest.git (push)

eqiasui@CN00214190 MINGW64 ~/Documents/practice (master)
$ git remote add origin [email protected]:qshilary/gittest.git

4. push again to find or report an error

eqiasui@CN00214190 MINGW64 ~/Documents/practice (master)
$ git push origin master
To github.com:qshilary/gittest.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to ‘[email protected]:qshilary/gittest.git’
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., ‘git pull …’) before pushing again.
hint: See the ‘Note about fast-forwards’ in ‘git push –help’ for details.

5. because the remote already has a project, but I do not have a local, so certainly can not push up, need to Git pull

eqiasui@CN00214190 MINGW64 ~/Documents/practice (master)
$ git pull
Warning: Permanently added the RSA host key for IP address ‘52.74.223.119’ to the list of known hosts.
warning: no common commits
remote: Counting objects: 42, done.
remote: Total 42 (delta 0), reused 0 (delta 0), pack-reused 42
Unpacking objects: 100% (42/42), done.
From github.com:qshilary/gittest
* [new branch] master -> origin/master
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

git branch –set-upstream-to=origin/<branch> master

6.Git pull Found an error reported

eqiasui@CN00214190 MINGW64 ~/Documents/practice (master)
$ git branch –set-upstream-to=origin/master master
Branch ‘master’ set up to track remote branch ‘master’ from ‘origin’.

eqiasui@CN00214190 MINGW64 ~/Documents/practice (master)
$ git pull
fatal: refusing to merge unrelated histories

eqiasui@CN00214190 MINGW64 ~/Documents/practice (master)
$ git pull origin master –allow-unrelated-histories
From github.com:qshilary/gittest
* branch master -> FETCH_HEAD
Merge made by the ‘recursive’ strategy.
Git-2.9.0-64-bit.exe | Bin 0 -> 31502824 bytes

git in the latest 2.9.2, merge pull two different projects, the problem appears how to go about solving fatal: refusing to merge unrelated histories

I created a new repository in Github, wrote License, and then uploaded a local repository that I had written for a long time.

First pull, because the two repositories are different, I found refusing to merge unrelated histories and couldn’t pull

Because they are two different projects, to merge two different projects, git needs to add a line of code in git pull, which happened in git version 2.9.2, the latest version needs to add --allow-unrelated-histories

If our source is origin and our branch is master, then we need to write git pull origin master ----allow-unrelated-histories knowing that our source can be a local path

Git Conflict error: Your local changes would be overwritten by merge. Commit, stash or revert them to proceed?

Git Conflict error: Your local changes would be overwritten by merge. Commit, stash or revert them to proceed?

 

How to Solve this error:

 

There are three solutions:

The first type: (Strongly not recommended, to be scolded) Ignore, directly commit your own code.

git commit -m “your msg”

The second: stash (strongly recommended method)

stash translates as “hidden”, as follows:

git stash
git pull
git stash pop
Then diff the file to see the automatic merge and make the necessary changes.

git stash: Back up the content of the current workspace, read the relevant content from the most recent submission, and ensure that the workspace is consistent with the content of the last submission. At the same time, save the current workspace content to the Git stack.
git stash pop: Read the last saved content from the Git stack and restore the relevant content of the workspace. Since there may be multiple Stash contents, they are managed by stacks. Pop will read the contents from the most recent stash and restore it.
git stash list: Display all the backups in the Git stack. You can use this list to determine where to restore.

git stash clear: Clear the Git stack. At this point, using graphical tools such as gitg, you will find that which nodes of the original stash have disappeared.

The third type (strongly not recommended, because you will overwrite what you have written, not recommended) hard coverage: abandon local modifications and directly overwrite the local code with the code on git:

git reset –hard
git pull

Supplement the above operations in idea:

Step 1: Right-click the project name->git->repository-> stash changes and fill in the information to backup

Step 2: Right-click the project name->git->repository->pull

Step 3: Right-click the project name->git->repository->unstash changes

In the third step, your local changes would be overwritten by merge, etc. may appear, because you have modified the files you pulled down before saving locally.

When this happens, click on the view below Your local changes would be overwritten by merge, select one file for one file, and there are three files when you select.

Left, middle and right, the middle is the result file, the left is the large file that was pulled down, and the right is the file that you modified locally. If you want to use the file that was pulled down, select accept left. If you want to save the local modification, select accept right. can

Method 2 stash:

Method 3 Hard Cover:

Commonly used git stash commands:

(1) git stash  save “save message”: When performing storage, add remarks to facilitate searching. Only git stash is also possible, but it is not easy to identify when searching.

(2) git stash list   : check which stores are stored in stash

(3) git stash show  : show what changes have been made, the default show is the first store, if you want to show other stores, add stash@{ $num}, such as the second git stash show stash@{1}

(4) git stash show -p  : Display the changes of the first store. If you want to display other stores, command: git stash show stash@{ $num} -p, such as the second one: git stash show stash@{1 } -p

(5) git stash apply  : apply a certain storage, but will not delete the storage from the storage list. The first storage is used by default, that is, stash@{0}. If you want to use another one, git stash apply stash@{ $ num}, such as the second one: git stash apply stash@{1}

(6) git stash pop  : command to restore the previously cached working directory, delete the corresponding stash in the cache stack, and apply the corresponding modification to the current working directory. The default is the first stash, that is, stash@{0}, If you want to apply and delete other stash, command: git stash pop stash@{ $num}, such as apply and delete the second one: git stash pop stash@{1}

(7) git stash drop  stash@{ $num}: discard stash@{$ num} storage, delete this storage from the list

(8) git stash clear :Delete all cached stash

[Solved] Updates were rejected because the tip of your current branch is behind

Problem Description.

Updates were rejected because the tip of your current branch is behind

Scenario.

Create a project on github or coding, then git init locally

and then no git pull -f –all

The readme file in the github version conflicts with the local version, and the reason for the conflict is given below.

[master][~/Downloads/ios] git push -u origin master

Username for ‘https://github.com’: shiren1118
Password for ‘https://[email protected]’:
To https://github.com/shiren1118/iOS_code_agile.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to ‘https://github.com/shiren1118/iOS_code_agile.git’
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. ‘git pull’)
hint: before pushing again.
hint: See the ‘Note about fast-forwards’ in ‘git push –help’ for details.

 

Workaround:

Check the box to force overwrite existing branches (changes may be lost), then click upload, and the upload succeeds.

[master][~/Downloads/ios] git push -u origin master -f

Translated with www.DeepL.com/Translator (free version)

 

When deploying Django project on centos7, there will be an error of importerror: cannot import name middlewaremin

Deployment on embedded devices has been fine, but this problem occurs on Linux Centos7, usually due to versioning issues.
Solution Install pip3 install Django==1.11.1
However, the following ImportError: cannot import name patterns
vim touch/extra_apps/DjangoUeditor/urls.py

# coding:utf-8
from django import VERSION

if VERSION[0:2] > (1, 3):
from django.conf.urls import patterns, url
else:
from django.conf.urls.defaults import patterns, url

from .views import get_ueditor_controller

urlpatterns = [
url(r’^controller/$’, get_ueditor_controller)
]

to:

# coding:utf-8
from django import VERSION

if VERSION[0:2] > (1, 3):
from django.conf.urls import url
else:
from django.conf.urls.defaults import url

from .views import get_ueditor_controller

urlpatterns = [
url(r’^controller/$’, get_ueditor_controller)
]

Due to version issues, this may cause the following problems

render_to_string() got an unexpected keyword argument ‘context_instance’

Solution:

context must be a dict rather than RequestContext.

is when the context becomes
{
“context”:context
}

Due to the version upgrade, the previous code

return render_to_response(‘info_count.html’, {}, context_instance=RequestContext(request))

should be rewritten to something like this.

from django.shortcuts import render

return render(request, “info_main.html”, {‘time_refresh’: time_refresh,
‘time_refresh_long’: time_refresh_long,
‘time_refresh_net’: time_refresh_net,
‘version’: version})

gitfatal: I don’t handle protocol ‘​https’ [How to Solve]

1. Background notes

Today, GIT clone times fatal: I don’t handle protocol ‘HTTPS’ is used in cygwin as follows:

I thought that there was something wrong with git implemented by cygwin, so I didn’t care too much about it. I replaced it with CMD, but it still reported fatal: I don’t handle protocol ‘HTTPS’

And there is a warning: your console font probably doesn’t support Unicode

Title bar right click attribute, change the font to imitation song, the warning is gone, but still fatal: I don’t handle protocol ‘HTTPS’

There is no way to search for a wave, and then I see a lot of like answers on stackoverflow

Special characters?It’s reasonable that git can’t not support HTTPS, and I don’t have a Chinese link. How can Unicode appear in CMD

Looking back at the link carefully, we finally find the answer: there are two spaces before HTTPS. Two spaces are not the problem, but the problem is that one space is Unicode

2. Treatment method

This kind of error rate is probably caused by special characters before the link, especially before the protocol (such as HTTP and HTTPS)

For example, the error I report here is that there is a Unicode space in front of HTTPS. Just delete it and then execute it

Svn is already under version control [How to Solve]

When svn ci, xx is already under version control appears, and then it cannot be submitted. The reason for this problem is that the file or directory you submitted is something from other SVN, that is, there are .svn directories underneath. You need to delete them before submitting. The specific operations are as follows:

Open the terminal, cd to the newly added directory, and then use the following command

#find . -mindepth 2 -name '.svn' -exec rm -rf '{}' \;

This command will delete all .svn folders in the directory recursively. Now, try submitting it again?

 

.svn can also be deleted directly

 

 

 

Ubantu Start Error: invalid environment block. Press any key to continue

Today, I want to open ubantu as usual, but I can’t open it normally, as shown in the figure below

It means invalid environment module. Press any key to continue, as shown in the figure below

 

cause of error: SD card is damaged and disk detection fails. It may be caused by sudden power failure or other abnormal shutdown of the system

note: it dawned on me at this time, because every time I shut down my computer, I didn’t turn off ubantu first (at that time, I wanted to shut down directly, and all programs would turn off automatically, it doesn’t matter)

solution:

enter the command fsck.ext3 – Y/dev/sda1 and restart

note: here, 1 in sda1 is changed to your broken disk

note: if not, try this command: fsck – Y/dev/sda1 and restart

Nginx Startup Error: Job for nginx.service failed because the control process exited with error code. See …

Contact nginx for the first time. After installing and using the command service nignx restart , this error appears. Follow the command given in the prompt to view the error details systemctl status nginx. Service :

We can see from the details: (98: address already in use), which indicates that the port has been occupied. Let’s see what is occupying the port

Input command: netstat – apn|grep: 80

You can see that the 13929/httpd service occupies port 80 and needs to be shut down. (I tried to kill the process with kill, but it was invalid)

Execute the command: Service httpd stop to close the httpd service

Then restart niginx to start it

Nginx Error: Job for nginx.service failed because the control process exited with error code

Job for nginx.service failed because the control process exited with error code

View Status

systemctl status nginx.service

nginx.service – The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2021-01-15 20:18:19 CST; 2min 1s ago
Process: 439 ExecStart=/usr/sbin/nginx (code=exited, status=1/FAILURE)
Process: 437 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
Process: 436 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)

Jan 15 20:18:18 iZ2zehly2ejxq9dlkzklw9Z nginx[439]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Jan 15 20:18:18 iZ2zehly2ejxq9dlkzklw9Z nginx[439]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Jan 15 20:18:18 iZ2zehly2ejxq9dlkzklw9Z nginx[439]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Jan 15 20:18:18 iZ2zehly2ejxq9dlkzklw9Z nginx[439]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Jan 15 20:18:19 iZ2zehly2ejxq9dlkzklw9Z nginx[439]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Jan 15 20:18:19 iZ2zehly2ejxq9dlkzklw9Z nginx[439]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Jan 15 20:18:19 iZ2zehly2ejxq9dlkzklw9Z nginx[439]: nginx: [emerg] still could not bind()
Jan 15 20:18:19 iZ2zehly2ejxq9dlkzklw9Z systemd[1]: nginx.service: Control process exited, code=exited status=1
Jan 15 20:18:19 iZ2zehly2ejxq9dlkzklw9Z systemd[1]: nginx.service: Failed with result ‘exit-code’.
Jan 15 20:18:19 iZ2zehly2ejxq9dlkzklw9Z systemd[1]: Failed to start The nginx HTTP and reverse proxy server.

Problem

nginx: [emerg] bind() to 0.0.0.0:80 failed

 

Checking port 80 is occupied
kill pid

 

Restart nginx

systemctl start nginx.service