Git相关知识

2022-09-23 20:33:14 浏览数 (1)

1 Git global setup

代码语言:javascript复制
git config --global user.name "xianggu625"
git config --global user.email "xianggu625@126.com"

2 Create a new repository

代码语言:javascript复制
git clone https://github.com/xianggu625/ebussiness.git
cd multibrach
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master

3 Push an existing folder

代码语言:javascript复制
cd existing_folder
git init
git remote add origin https://github.com/xianggu625/ebussiness.git
git add .
git commit -m "Initial commit"
git push -u origin master

4 Push an existing Git repository

代码语言:javascript复制
cd existing_repo
git remote rename origin old-origin
git remote add origin http://192.168.0.114/jerrygu625/mytest.git
git push -u origin --all
git push -u origin --tags

5 Git更新代码

代码语言:javascript复制
cd existing_folder
git clone https://github.com/xianggu625/ebussiness.git
git status

1、查看当前的git仓库状态,可以使用git status

2、如果是在刚才新建的文件夹输入git status 会提示你git目录不对

3、先用cd命令切换到gubai这个repository目录

4、再输入git status可以看到On branch master,这个说明已经在master分之上了

更新代码

代码语言:javascript复制
git add *

接着输入git commit -m "更新说明",commit只是提交到缓存区域

代码语言:javascript复制
git commit -m "更新说明”
git push origin master

问题

1 全局变量失败

1、配置用户信息

代码语言:javascript复制
git config --global user.name [username]
git config --global user.email [email]

2、查询用户信息

代码语言:javascript复制
git config --list

3、如果push遇到在输入密码错误后,就会报这个错误fatal: Authentication failed for

解决办法:

代码语言:javascript复制
git config --system --unset credential.helper

之后你在push就会提示输入名称和密码

2 发现git config --list内容有错误

代码语言:javascript复制
git config -–global user.name "xxx"
git config –-global user.email "xxx@xxx.com"

或者运行

代码语言:javascript复制
C:Usersxiang>git config --list --show-origin
file:"C:\ProgramData/Git/config"       core.symlinks=false
file:"C:\ProgramData/Git/config"       core.autocrlf=true
file:"C:\ProgramData/Git/config"       core.fscache=true
file:"C:\ProgramData/Git/config"       color.diff=auto
file:"C:\ProgramData/Git/config"       color.status=auto
file:"C:\ProgramData/Git/config"       color.branch=auto
file:"C:\ProgramData/Git/config"       color.interactive=true
file:"C:\ProgramData/Git/config"       help.format=html
file:"C:\ProgramData/Git/config"       rebase.autosquash=true
file:C:/Program Files/Git/mingw64/etc/gitconfig http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
file:C:/Program Files/Git/mingw64/etc/gitconfig http.sslbackend=openssl
file:C:/Program Files/Git/mingw64/etc/gitconfig diff.astextplain.textconv=astextplain
file:C:/Program Files/Git/mingw64/etc/gitconfig filter.lfs.clean=git-lfs clean -- %f
file:C:/Program Files/Git/mingw64/etc/gitconfig filter.lfs.smudge=git-lfs smudge -- %f
file:C:/Program Files/Git/mingw64/etc/gitconfig filter.lfs.process=git-lfs filter-process
file:C:/Program Files/Git/mingw64/etc/gitconfig filter.lfs.required=true
file:C:/Program Files/Git/mingw64/etc/gitconfig credential.helper=manager
file:C:/Users/xiang/.gitconfig  user.name=xianggu625
file:C:/Users/xiang/.gitconfig  user.email=xianggu625@126.com
file:C:/Users/xiang/.gitconfig  http.postbuffer=524288000
file:.git/config        core.repositoryformatversion=0
file:.git/config        core.filemode=false
file:.git/config        core.bare=false
file:.git/config        core.logallrefupdates=true
file:.git/config        core.symlinks=false
file:.git/config        core.ignorecase=true
file:.git/config        gui.wmstate=zoomed
file:.git/config        gui.geometry=1061x563 96 96 233 255
file:.git/config        remote.origin.url=http://192.168.0.114/jerrygu625/mytest.git
file:.git/config        remote.origin.fetch= refs/heads/*:refs/remotes/origin/*

直接用写字板打开文件进行修改

3 GitHub.com无法访问,连接超时的问题

1、ping github网站(Ping github.com),ping不通,说明dns无法解析导致的

2.打开C:WindowsSystem32driversetchosts,在文件末尾添加如下内容,并保存:

代码语言:javascript复制
192.30.255.112  github.com git
185.31.16.184 github.global.ssl.fastly.net

3.重启cmd窗口,继续ping一下github.com,本机已经能够正常解析github.com这个域名。

4.打开浏览器重新输入https://github.com/可以访问

4 fatal: unable to access 'https://github.com/xianggu625/ebussiness.git/': OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10053

网络不稳定,重新输入

5 Git首次推送一直报错:Logon failed, use ctrl c to cancel basic credential prompt.

参见:https://blog.csdn.net/ZhaZha__Hui/article/details/122829072

顾翔老师的新书《全栈软件测试工程师宝典》,

京东网站购书地址:https://item.jd.com/13005594.html

文末惊喜

渗透式测试环境与代码

实验代码:

链接:https://pan.baidu.com/s/14XsCng6laiSiT_anuwr5dw?pwd=78dy

提取码:78dy

环境

Windows上安装tomcat、Apache和MySQL

Linux上安装tomcat、Apache和MySQL

操作

1、把tomcat中的sec拷贝到tomcat目录下,比如%TOMCAT-HOME%webapps

2、把Apache中的sec拷贝到Apache目录下,比如htdocs

3、tomcat中的sec目录下

include.jsp

代码语言:javascript复制
<%
String
Windows_IP="127.0.0.1";
String
Linux_IP="192.168.0.150";
String
JSP_PORT="8080";
String
PHP_PORT="8100";
%>
  • String Windows_IP:Windows的IP地址
  • String Linux_IP:Linux的IP地址
  • String JSP_PORT:JSP的端口号
  • String PHP_PORT:PHP的端口号

3、Apache中的sec目录下include.php

代码语言:javascript复制
$windows_ip="http://127.0.0.1";
$linux_ip="http://192.168.0.150";
$jsp_port="8080";
$php_port="8100";
?>
  • $windows_ip:Windows的IP地址
  • $linux_ip=:Linux的IP地址
  • $jsp_port=:JSP的端口号
  • $php_port:PHP的端口号

打开浏览,输入http://192.168.0.106:8080/sec/

192.168.0.106为本机IP地址

数据库配置

在建立MySQL下建立sec数据库,root/123456。将DB下的4个csv文件导入sec数据库中

渗透测试操作系统虚拟机文件vmx文件

1)Windows 2000 Professional

链接:https://pan.baidu.com/s/13OSz_7H1mIpMKJMq92nEqg?pwd=upsm

提取码:upsm

2)Windows Server 2003 Standard x64 Edition

链接:https://pan.baidu.com/s/1Ro-BoTmp-1kq0W_lB9Oiww?pwd=ngsb

提取码:ngsb

开机密码:123456

3)Windows 7 x64

链接:https://pan.baidu.com/s/1-vLtP58-GXmkau0OLNoGcg?pwd=zp3o

提取码:zp3o

4)Debian 6(Kali Linux)

链接:https://pan.baidu.com/s/1Uw6SXS8z_IxdkNpLr9y0zQ?pwd=s2i5

提取码:s2i5

开机密码:jerry/123456

安装了Apatche、Tomcat、MySQL、 vsftpd并且配套Web安全测试练习教案。

启动Tomcat

#/usr/local/apache-tomcat-8.5.81/bin/startup.sh

启动MySQL

#service mysql start

启动Apache

#/etc/init.d/apache2 start

打开浏览器输入127.0.0.1:8080/sec/

5)Metasploitable2-Linux (with vsftpd 2.3.4)

链接:https://pan.baidu.com/s/1a71zOXGi_9aLrXyEnvkHwQ?pwd=17g6

提取码:17g6

开机密码:见页面提示

解压后直接为vmx文件,直接可用

0 人点赞