上传、更新

1.git config --global user.name "c"  //配置用户名

2.git config --global user.email  "[email protected]"    //配置邮箱

3.  ssh-****** -t rsa -C "[email protected]"    //本地生成**

4. 登录gitlab,自己的账户,setting中添加生成的**

5 git init   //初始化仓库

git clone  [email protected]

6   git remote add origin  [email protected]:co/testproject.git   //添加远程仓库   

git  fetch //获取远程仓库文件

7.git  status  //查看分支状态

8 git  branch  -a//查看当前分支

git checkout master  //切换分支

git checkout -b master  //创建分支,并切换

9 git  add  <file>    //添加文件到服务器,类似svn的add

10 git commit  -m "注释内容"
 

11 git  push -u origin 分支名称

 

问题:

1.上传失败   报“! [remote rejected] master -> master (pre-receive hook declined)”

原因:所push的分支权限为protected,只有项目的管理员或者项目的管理员指派的具有相应权限的人才能进行push,要进行项目的push,有如下两种方法:

解决方法:

1.将所要push的内容所在的分支的protected权限关闭

(1)进入所在项目的settings

本地代码上传到gitlab

(2)点击进入Protected branches,点击unprotected将master分支的权限改变,即关闭master的protected权限

本地代码上传到gitlab

2.新建其它分支,将项目push到新建的分支上,后期再进行merge

(1)新建分支

git branch 分支名

(2)切换分支

git checkout 分支名

(3)进行项目上传

git add .

git commit -m "提交的信息"

git remote add origin 远程仓库地址

git push -u origin 分支名

 

 

 

 

删除本地分支:

git branch -d 分支名

删除远程分支

git push origin --delete  分支名

将A合并到当前分支

git  merge  A

 

Project members permissions

Note: In GitLab 11.0, the Master role was renamed to Maintainer.

The following table depicts the various user permission levels in a project.

Action Guest Reporter Developer Maintainer Owner
Create new issue ✓ 1
Create confidential issue ✓ 1
View confidential issues (✓) 2
Leave comments ✓ 1
See related issues
See a list of jobs ✓ 3
See a job log ✓ 3
Download and browse job artifacts ✓ 3
View wiki pages ✓ 1
View license management reports  ✓ 1
View Security reports  ✓ 1
View project code 1
Pull project code 1
Download project 1
Assign issues  
Assign merge requests    
Label issues  
Label merge requests    
Create code snippets  
Manage issue tracker  
Manage labels  
See a commit status  
See a container registry  
See environments  
See a list of merge requests  
Manage related issues   
Lock issue discussions  
Create issue from vulnerability   
View Error Tracking list  
Pull from Maven repository or NPM registry   
Publish to Maven repository or NPM registry     
Lock merge request discussions    
Create new environments    
Stop environments    
Manage/Accept merge requests    
Create new merge request    
Create new branches    
Push to non-protected branches    
Force push to non-protected branches    
Remove non-protected branches    
Add tags    
Write a wiki    
Cancel and retry jobs    
Create or update commit status    
Update a container registry    
Remove a container registry image    
Create/edit/delete project milestones    
View approved/blacklisted licenses 
Use security dashboard     
Dismiss vulnerability     
Apply code change suggestions    
Use environment terminals      
Run Web IDE’s Interactive Web Terminals       
Add new team members      
Push to protected branches      
Enable/disable branch protection      
Turn on/off protected branch push for devs      
Enable/disable tag protections      
Rewrite/remove Git tags      
Edit project      
Add deploy keys to project      
Configure project hooks      
Manage Runners      
Manage job triggers      
Manage variables      
Manage GitLab Pages      
Manage GitLab Pages domains and certificates      
Remove GitLab Pages      
View GitLab Pages protected by access control
Manage clusters      
Manage license policy       
Edit comments (posted by any user)      
Manage Error Tracking      
Switch visibility level        
Transfer project to another namespace        
Remove project        
Delete issues        
Force push to protected branches 4          
Remove protected branches 4          
View project Audit Events      
View project statistics      

 

相关文章:

  • 2019-03-22
  • 2022-01-07
  • 2022-01-07
  • 2022-01-06
  • 2021-11-26
猜你喜欢
  • 2021-04-24
  • 2021-08-20
  • 2021-07-08
  • 2021-05-03
  • 2021-06-07
  • 2021-11-19
相关资源
相似解决方案