Tag Archives: git

Solution: git uses git push to jump out of remote: permission to a denied to B

I started git uploading the project. Unexpectedly, an error occurred in the git push step?

remote: Permission to qwe2193066947/firstRepository.git denied to murenziwei.

fatal: unable to access’https://github.com/qwe2193066947/firstRepository.git/’: The requested URL returned error: 403

Nani! what happened? ! Can’t find the file?

This error translates into Chinese roughly: user murenziwei does not have permission to access the firstRepository of user qwe2193066947.

In other words, in the terminal of the git environment, I logged in with the murenziwei account, so I should change to the qwe2193066947 account to solve the problem.

So, immediately execute the relevant git command line to log in to the github account

1
2
git config --global user.name xxx
git config --global user.email xxx@xxx

However, if you don’t even see the steps to enter the password, it can be considered as a successful account switch? Obviously, after this failure, one can only find another solution through online information.

Since I am using an ASUS desktop, the operation may be different, but the principles are similar.

Control Panel-->User

 

After editing the account, go back to the terminal and enter git push again. If nothing else, your family will be able to call your family, and the problem should be solved.

 

After hell-like training, the power of heaven was created. Fingers that shed blood, pop the world’s swan song!

 

[Solved] Git remote:error:refusing to update checked out branch:refs/heads/master”

remote:error:refusing to update checked out branch:refs/heads/master”

When using Git to push code to a data repository, the following error is prompted:</p

[remote rejected] master -> master (branch is currently checked out)

Prototype error

remote: error: refusing to update checked out branch: refs/heads/master

remote: error: By default, updating the current branch in a non-bare repository

remote: error: is denied, because it will make the index and work tree inconsistent

remote: error: with what you pushed, and will require ‘git reset –hard’ to match

remote: error: the work tree to HEAD.

remote: error:

remote: error: You can set ‘receive.denyCurrentBranch’ configuration variable to

remote: error: ‘ignore’ or ‘warn’ in the remote repository to allow pushing into

remote: error: its current branch; however, this is not recommended unless you

remote: error: arranged to update its work tree to match what you pushed in some

remote: error: other way.

remote: error:

remote: error: To squelch this message and still keep the default behaviour, set

remote: error: ‘receive.denyCurrentBranch’ configuration variable to ‘refuse’.

To [email protected]:/var/git.server/…/web

! [remote rejected] master -> master (branch is currently checked out)

error: failed to push some refs to ‘[email protected]:/var/git.server/…/web’

Workaround:

This is because git rejects push operations by default, and needs to be set up by modifying the .git/config file followed by the following code:</p

[receive]
denyCurrentBranch = ignore</p

Reasons and solutions for not being able to view files in git after a push</p

It’s best to use when initializing remote repositories</p

git –bare init</p
</blockquoteInstead of using: git init</p

Specific difference between git init and git –bare init:http://blog.haohtml.com/archives/12265</p

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

If you use git init to initialize, the remote repository’s directory also contains the work tree, so when the local repository pushes to the remote repository, if the remote repository is on the branch that is being pushed (which is fine if it is not on the branch that is being pushed), then the results of the push will not be reflected in the work tree, i.e., in the The files in the remote repository’s directory are still the same as before. </p

Solution:

You must use the command git reset –hard to see the contents of the push. </p

I researched for a long time and found a command that worked:</p

Log in to the remote folder and use

git config –bool core.bare true</p

And you’re done.

Post a reference to the article.

Create a bare GIT repository

A small rant: git is unable to create a normal bare repository by itself. Stupid git indeed.

To be precise,it is not possible to clone empty repositories. So an empty repository is a useless repository. Indeed, you normally create an empty repository and immediately fill it:

git init git add .

However,git addis not possible when you create a bare repository:

git –bare init git add .

gives an error “fatal: This operation must be run in a work tree”.

You can’t check it out either:

Initialized empty Git repository in /home/user/myrepos/.git/ fatal:http://repository.example.org/projects/myrepos.git/info/refsnot found: did you run git update-server-info on the server?git –bare init git update-server-info # this creates the info/refs file chown -R <user>:<group> . # make sure others can update the repository

The solution is to createanother repositoryelsewhere, add a file in that repository and, push it to the bare repository.

mkdir temp; cd temp git init touch .gitignore git add .gitignore git commit -m “Initial commit” git push <url or path of bare repository> master cd ..; rm -rf temp

Git Error: fatal: remote origin already exists [How to Solve]

When you enter $git remote add [email protected] : djqiang (GitHub account name)/gitdemo (project name). Git

The following error occurred:

The solution is as follows:

1. Enter $git remote RM origin first

2. Then enter $git remote add origin [email protected] : djqiang/gitdemo.git will not report error

3. Error: could not remove config section ‘remote. Origin’. We need to modify the content of gitconfig file

4. Find the installation path of your GitHub, and mine is C:: (users) ﹣ ASUS ﹣ appdata ﹣ local ﹣ GitHub ﹣ portablegit_ ca477551eeb4aea0e4ae9fcd3358bd96720bb5c8\etc

5. Find a file named gitconfig, open it, and delete the line [remote “origin”]

Git Add The Public Key sign_and_send_pubkey: signing failed: agent refused operation

After adding the public key to the server, an error is reported

sign_and_send_pubkey: signing failed: agent refused operation

Solution.

    eval
"$(ssh-agent -s)"

    ssh-add

More:

linux shell eval

 

Syntax: eval cmdLine

eval scans the cmdLine twice. If the cmdLine is a normal command after the first scan, it is executed; if the cmdLine contains an indirect reference to a variable, the semantics of the indirect reference is guaranteed.

 

Examples are as follows.

set 11 22 33 44

If you want to output the last parameter, i.e. 44, you can use the following command.

echo $4

But if we don't know how many arguments there are, and we want to output the last argument, we may think of using $# to output the last argument.

If the command is used.

echo "\$$#"

The result is $4, not 44 as we would like, and there is a problem with indirect references to variables.

This is where the eval command can be used.

eval echo "\$$#"

The result is 44
ssh-add command details

Syntax


ssh-add [-cDdLlXx] [-t life] [file ...]

ssh-add -s pkcs11 

ssh-add -e pkcs11

Parameter description

    -D :Delete all keys from ssh-agent;

    -d : delete the keys from ssh-agent;

    -e : pkcs11 : delete the key provided by PKCS#11 shared library pkcs1;

    -s : pkcs11 : add the keys provided by PKCS#11 shared library pkcs1;

    -L : Show the public key in ssh-agent;

    -l : show the key in the ssh-agent;

    -t : life: set timeout for loaded keys, ssh-agent will automatically unload the keys after the timeout;

    -X : unlock ssh-agent;

    -x : unlock ssh-agent; -x : lock ssh-agent;

Example

Add a special key to the ssh-agent cache

ssh-add /home/chen/.ssh/id_rsa

Remove the key from the ssh-agent

ssh-add -d /home/chen/.ssh/id_rsa.pub

View the key in ssh-agent

ssh-add -l

Git Submit Error: The file will have its original line endings in your working directory.

Error reporting

This error is found when git add

Error analysis

Depending on the situation, it should be caused by the inadequate recognition of line feed by different systems

As far as common sense is concerned, the file is generated under windows, so the newline is really different from Linux, which may be caused by this

Error report solution

git config --global core.autocrlf false

In the same way, we should also do related operations in pychar

If you select fix and commit, it will be set to true and will be converted

So we have to choose commit as LS

Additional supplement

Line ending in Git

Core.autocrlf is the variable responsible for processing line ending in GIT. It can set three values: true, false and inout

(1) Set to true [config — global core. Autocrlftrue]

When set to true, this means that whenever you add a file to the GIT repository, GIT will treat it as a text file

It will turn CRLF into LF

(2) Set to false [config — global core. Autocrlffalse]

When set to false, line endings will not do conversion. The text file remains the same

(3) When it is set to input, GIT programs the CRLF to input when git repository is added. When someone checks the code, it’s still in LF mode. Therefore, in the window operating system, do not use this setting

Git Error: The requested URL returned error: 403 Forbidden while accessing

When committing code to git, this error appears “error: The requested URL returned error: 403 Forbidden while accessing https”

Workaround.

Edit the config file in the .git directory.

vim .git/config

[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote “origin”]

url = https://[email protected]/enzhouguo/video_web.git
//old url = https://github.com/enzhouguo/video_web.git

//new url = https://[email protected]/enzhouguo/video_web.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch “master”]
remote = origin
merge = refs/heads/master

Eclipse reports “there are no staged files” by using git submission code

When using eclipse, there may be a small problem when submitting code to git library. As follows, share the solution

Window — preferences — team — git — Commenting don’t check the part in the red box

So the familiar window will appear, OK

level is limited, if you have any questions, please leave a message

learn from each other and make progress together:) please indicate the source of the reprint, thank you

Git :git – error: RPC failed; curl 18 transfer closed with outstanding read data remaining

error: RPC failed; curl 18 transfer closed with outstanding read data remaining

because have error when clone by HTTP protocol (curl command).

And, you should increment buffer size:

git config --global http.postBuffer 524288000

Reason: due to Http protocol error, when Pull or Clone. 
 
 Solution: Execute the git config --global http.postBuffer 524288000 command in Git Bash Here , 
       
        and then execute the git pull or git clone command.

 

Git Error: fatal: Unable to find remote helper for ‘https’

Get code remotely using Git

git clone https://github.com/twlkyao/findfile.git

“Fatal: unable to find remote helper for ‘HTTPS'” (this is because git environment is not completely installed after re installation and needs to be re installed). You can temporarily use git instead of HTTPS and use the following command:

git clone git://github.com/twlkyao/findfile.git

Here we will use code installation to introduce:

Switch to code directory:

cd /opt/git-1.8.1.2/

Then follow the instructions in INSTALL to set the installation prefix (usually using root installation):

$ make
prefix=/usr all doc info ;# as yourself

# make
prefix=/usr install install-doc install-html install-info ;# as root

then make install

# make install