目录
一、Git下载
Git下载,地址Git - Downloadshttps://git-scm.com/downloads打开安装包后,选择下载路径,然后一路默认即可完成安装。
二、IDEA上传项目到Git
打开IDEA,打开File→Settings→Version Control→Git
在Path to Git executable中选择你下载Git的路径,然后点击Test测试是否连接成功
然后点击下面的Github,登录Github的账户
结果出现了如下的错误
出现如下错误可以改用token来登录,打开你的Github,打开Settings,点击Developer Settings
点击Personal access tokens→Generate new token
在note中随便输入token的描述,注意下面的选项全部打勾。
完成token的创建
复制token到IDEA的Github中进行token的登录
登录成功
创建本地仓库VCS→import into Version Control→Create Git Repository
选择要上传的文件
右键该项目→Git→add
此时还没有提交到本地仓库,再次右键文件→Git→Commit Directory
点击commit完成提交
点击VCS→import into Version Control→Share Project on GitHub
这样就可以在你的Github账号中看到此仓库了!
三、编辑静态网页并观察Git上新旧版本的交替
首先编辑一个静态网页效果如下(这是以前在VSCode中做的):
代码:
html
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../css/Login.css">
<link rel="stylesheet" href="../css/pub.css">
<title>登陆页面</title>
</head>
<body>
<div class="loginbox">
<h2 class=Ltitle>登录</h2>
<div class="usernamebox">
<label for="usrlabel" class="usrlabel">用户名</label>
<input type="text" class="username" id="uname" required>
</div>
<div class="passwordbox">
<label for="pwdlabel" class="pwdlabel">密码</label>
<input type="password" class="password" id="pwd" required>
</div>
<span class="msg" id="msg"></span>
<div class="character">
<select name="type">
<option value="">登陆类型</option>
<option value="0">管理员</option>
<option value="1">检测员</option>
<option value="2">普通访客</option>
</select>
</div>
<button class="loginbtn">登录
<span></span>
<span></span>
<span></span>
<span></span>
</button>
</div>
</body>
<script type="text/javascript">
$("#loginbtn").click(function(){
var usname=$("uname").val();
var pwd=$("pwd").val();
if(isEmpty(uname)){
$("#msg").html("用户名不可为空");
return;
}
if(isEmpty(pwd)){
$("#msg").html("用户密码不可为空");
return;
}
$("#loginform").submit();
});
function isEnpty(str){
if(str==null||str.trim()=""){
return true;
}
return false;
}
</script>
</html>
页面的相应样式表
html,body{
background-image: url(../img/bkg.png);
height: 100%;
background-repeat: no-repeat;
background-size: 100% 100%;
margin: 0px;
padding: 0px;
}
input,button{
background: transparent;
border: none;
}
.loginbox{
top: 25%;
left: 35%;
right: 35%;
position: absolute;
width: 30%;
height: 50%;
background: rgba(0, 0, 0, .5);
box-shadow: 0px 15px 25px 0px rgba(0, 0, 0, .6);
padding: 40px;
box-sizing: border-box;
border-radius: 5px;
}
.Ltitle{
text-align: center;
color: wheat;
margin-bottom: 10px;
}
.usernamebox,.passwordbox{
height: 60px;
border-bottom: 1px solid #fff;
margin-bottom: 40px;
position: relative;
}
.username,.password{
top: 50%;
width: 100%;
height: 50%;
color: #fff;
padding-top: 0px;
box-sizing: border-box;
position: absolute;
}
.usrlabel,.pwdlabel{
position: absolute;
left: 0;
top: 0;
color: wheat;
}
.username[type=text]:focus{ outline: 1px solid wheat;}
.password[type=password]:focus{ outline: 1px solid wheat;}
.loginbtn{
padding:10px 20px;
overflow: hidden;
margin-top: 0px;
color: wheat;
position: relative;
text-transform: uppercase;
letter-spacing: 2px;
}
.loginbtn:hover{
background: wheat;
border-radius: 5px;
color: white;
box-shadow: 0 0 5px 0 wheat,
0 0 25px 0 wheat,
0 0 50px 0 wheat,
0 0 100px 0 wheat;
}
.loginbtn>span{
position: absolute;
}
.loginbtn>span:nth-child(1){
width: 100%;
height: 2px;
background: -webkit-linear-gradient(left,transparent,wheat);
left: -100%;
top: 0px;
animation: line1 1s linear infinite;
}
@keyframes line1{
50%,100%{
left: 100%;
}
}
.loginbtn>span:nth-child(2){
width: 2px;
height: 100%;
background: -webkit-linear-gradient(top,transparent,wheat);
top: -100%;
right: 0px;
animation: line2 1s 0.25s linear infinite;
}
@keyframes line2{
50%,100%{
top: 100%;
}
}
.loginbtn>span:nth-child(3){
width: 100%;
height: 2px;
background: -webkit-linear-gradient(right,transparent,wheat);
left: 100%;
bottom: 0px;
animation: line3 1s 0.5s linear infinite;
}
@keyframes line3{
50%,100%{
left: -100%;
}
}
.loginbtn>span:nth-child(4){
width: 2px;
height: 100%;
background: -webkit-linear-gradient(bottom,transparent,wheat);
bottom: -100%;
left: 0px;
animation: line4 1s 0.75s linear infinite;
}
@keyframes line4{
50%,100%{
bottom: 100%;
}
}
.character{
background-color: transparent;
width: 60px;
top: 75%;
margin-bottom: 10px;
margin-top: 10px;
position: absolute;
}
.character select{
background-color: transparent;
border: 0;
border-radius: 5px;
background: transparent;
color: wheat;
}
.character option{
color: wheat;
background: rgba(0, 0, 0, .5);
border: none;
margin: 0;
padding: 0;
}
.msg{
margin: 0;
padding: 0;
width: 100%;
background-color: red;
font-size: 12px;
}
公共样式表
.box{
display: flex;
justify-content: center;
align-items: center;
background: #060c21;
}
.box::before {
content:"";
position: absolute;
top: -2px;
bottom: -2px;
right: -2px;
left: -2px;
background: #fff;
z-index: -1;
}
.box::after {
content:"";
position: absolute;
top: -2px;
bottom: -2px;
right: -2px;
left: -2px;
background: #fff;
z-index: -2;
filter: blur(40px);
}
.box::before,
.box::after {
background: linear-gradient(235deg,#89ff00,#060c21,#00bcd4);
}
.content {
padding: 20px;
box-sizing: border-box;
color: #fff;
}
在IDEA中创建相应的文件和css文件夹并将代码复制粘贴到IDEA项目中,会出现以下提示:
点击add,将文件夹添加到Git中
再修改代码中的部分命名问题,在IDEA中打开此网页显示效果
和上面一样的步骤提交