GitLab creates a private warehouse to establish a problem-solving path for establishing a connection

Table of contents

1. Generate SSH keys

2. An error occurred in git clone Could not resolve host: github.com problem

3. After Little Turtle sets up the remote URL, there will be an error message for synchronizing files

Four, git create push steps

5. Little turtle failed to push

6. The little turtle does not display the check mark icon

Seven, git tracking download specified version code

8. Error pulling code from git


1. Generate SSH keys

1. Enter the command to get the key

1)ssh-keygen -t rsa -C "[email protected]"   //邮箱用自己的邮箱
2)输入回车
3)输入回车

2. The generated key is in the id_rsa.pub file

cd /c/Users/*****/.ssh   //生成的密匙显示路径,先跳入.ssh文件夹下
cat id_rsa.pub           //输入该指令查看密匙,复制一下

3. Search for SSH at the top of gitlab, paste and save after entering

2. An error occurred in git clone Could not resolve host:  github .com problem

1. Analyze the domain name. The reason for the error may be that gitlab.com the domain name is not resolved by the host

ping gitlab.com         //ping一下该网络得到解析域名地址

2. Add a domain name.

In the [hosts] file under the windows/System32/drivers/etc folder of the C drive, open it with notepad++

172.65.251.78		gitlab.com      //文件在末尾添加该函数,域名用自己ping的域名替换

After the file is saved, the problem is solved, and the clone can succeed again.

3. After Little Turtle sets up the remote URL, there will be an error message for synchronizing files

TortoiseGit错误 - Could not get all refs. libgit2 returned: corrupted loose reference file

Solution:

 rm -fr .git                                          //删除.git文件
 git init                                             //初始化git
 git remote add origin your-git-remote-url            //URL要修改为自己的 如下图提示
 git fetch                                            //同步远程库
 git reset --hard origin/master                       //复位master分支
 git branch --set-upstream-to=origin/master master    //切换到仓库主分支master

Four, git create push steps

1. Create a folder and create a library

cp -r /d/sdk/*  /d/git/            //从一个文件里复制代码到本地

2. Set git remote

 3. Push directly

5. Little turtle failed to push

1、问题:remote: GitLab: You are not allowed to force push code to a protected branch on this project.
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.

Reason: Since the current user does not have push permission, the [master] code is protected by default, so an error will be reported when pushing, just remove the protection permission.

Solution:

2、问题:Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes 

The update was rejected because the tip of your current branch is behind. Hint: its remote counterpart. Integrate remote changes

Solution:

git pull origin master --allow-unrelated-histories   //拉取的时候忽略历史提交
                                                     //操作完后点x关闭指令界面

git push origin master:master                        //制定推送到master
上述方案没有结局问题,还是出现错误,采用创建新分支的方法解决问题
git branch [name]                 //创建新的分支      
git push origin [name]            //重新拉取

3. Problem: git pull prompt warning: redirecting to https://igit.**.com/**/**.git/ Already up to date.

Solution:

git remote remove origin                                //第一步:删除现有的origin地址

git remote add origin https://igit.**.com/**/**.git/    //第二步:重新绑定origin地址

6. The little turtle does not display the check mark icon

Solution:

 1. Turn on the icon overlay in the settings of the little turtle

2. Modify the git order in the registry

①Windows + R to run the command box 

②Enter regedit + enter to view the registry

③ Check the order of the relevant files of the little turtle according to the path. If it is not at the top, modify HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers as shown below

3. Restart and run the explorer.exe process

①End running explorer.exe first

 ②Start the explorer.exe process

Seven, git tracking download specified version code

1. Obtain the latest version code

git clone http://****************/v3.4

2. Find all version logs submitted

//进入该版本内 输入指令:git log

root@123:/mnt/hgfs/ESP8266_RTOS_SDK# git log

3. Download the version you need

//在当前目录下输入指令:
git checkout 0360263b55fd88a00d41d3fc6d0b955ef5b88000

8. Error pulling code from git

fatal: unable to access 'https://github.com/espressif/ESP8266_RTOS_SDK.git/': Failed to connect to 127.0.0.1 port 1080 after 2093 ms: Connection refused

git config --global  --list           //查看当前用户配置

git config --global --edit            //取消代理把HTTP网址连接127.0.0.1 相关删除

Continue to improve later. . .

Guess you like

Origin blog.csdn.net/m0_56769186/article/details/124866648