小白实习的gitlab使用笔记

创建新项目

1、在gitlab上创建项目
右上角有一个 new project
在这里插入图片描述
2、填写常规消息
按照你的项目名等等完成这些基础信息的填写
在这里插入图片描述
3、完成本地和远程仓库的链接、上传等等
在这里插入图片描述
这是创建新的项目成功之后网页上的一些提示的操作。我会忽略掉其中创建README的这一步。
我一般执行的操作如下:
(1)在本地项目根目录下右键打开“git bash here”
(2)依次输入:

git config --global user.name "你的用户名" 
git config --global user.email "你的邮箱"
git init 
git remote add origin 你刚才建立的项目连接 
git add . 
git commit 
git push -u origin master

4、无关文件的过滤
其实这个时候已经完成了一个项目的代码的提交
但是很多时候本地项目目录下的所有的文件都会被上传到gitlab上,所以一些本地的编译器等等与项目无关的一些文件都上传了,所以需要配置一下在上传的时候不需要的内容,这个时候就需要写一个.gitignore文件,具体如下:
仍然在git bash中输入:

vim .gitigorne

然后在跳出来的新建文件中输入你想要过滤的文件,我大概输入了一下的内容:

# Maven
target/
./target
target/*
*.class
*.ser
*.ec
 
# IntelliJ Idea
.idea/
out/
*.ipr
*.iws
*.iml
 
# Eclipse
.classpath
.project
.settings/
.metadata/
 
# OS X
.DS_Store

通过“wq!”保存之后,接着输入:

git add.
git commit -m "add .gitignore"
git push

大功告成!~

其他老是忘记的东西:
Git global setup

git config --global user.name "xxxx"
git config --global user.email "xxxxxx"

Create a new repository

git clone git@xxxxxx.git
cd dnn4homefeedsrecall
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master

Existing folder

cd existing_folder
git init
git remote add origin  git@xxxxxx.git
git add .
git commit -m "Initial commit"
git push -u origin master

Existing Git repository

cd existing_repo
git remote rename origin old-origin
git remote add origin  git@xxxxxx.git
git push -u origin --all
git push -u origin --tag
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值