首页 > 技术文章 > gitlab 常用命令随笔

janus2003 2022-01-12 11:35 原文

gitlab 常用命令随笔

 

1.项目初始化并上传到指定project


git init git remote add origin http://190.84.109.43:8099/root/smtmac.git git add . git commit -m "********系统代码提交" git push -u origin master

 

命令行指令Command line instructions

您还可以按照以下说明从计算机上传现有文件    -->You can also upload existing files from your computer using the instructions below.

Git全局设置  -->Git global setup
git config --global user.name "Administrator"
git config --global user.email "admin@example.com"

 

创建一个新的仓库 --> Create a new repository
git clone http://190.84.109.43:8099/root/industry4.git
cd industry4
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master

 

推送现有文件夹-->Push an existing folder
cd existing_folder
git init
git remote add origin http://190.84.109.43:8099/root/industry4.git
git add .
git commit -m "Initial commit"
git push -u origin master

 

推送现有的Git存储库-->Push an existing Git repository
cd existing_repo
git remote rename origin old-origin
git remote add origin http://190.84.109.43:8099/root/industry4.git
git push -u origin --all
git push -u origin --tags

 

 

 

2.当前代码修改状态查询

git status

3.git remote: HTTP Basic: Access denied 错误解决办法  

原因:本地git配置的用户名、密码与gitlabs上注册的用户名、密码不一致。

复制代码
解决方案: 
1. 如果账号密码有变动 用这个命令 git config –system –unset credential.helper 重新输入账号密码 应该就能解决了
2. 如果用了第一个命令 还不能解决问题那么 用这个命令:
git config –global http.emptyAuth true

至此错误解决完成。
复制代码

 

推荐阅读