echo "# spring-boot-apollo-demo" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/lixyu/spring-boot-apollo-demo.git
git push -u origin master
Command line instructions
Git global setup
git config --global user.name "test"
git config --global user.email "test@os.test.com"
Create a new repository
git clone http://10.138.60.166/lixinyu/boltloan.git
cd boltloan
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 http://10.138.60.166/lixinyu/boltloan.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 http://10.138.60.166/lixinyu/boltloan.git
git push -u origin --all
git push -u origin --tags
命令行合并(merge)代码
Step . Fetch and check out the branch for this merge request git fetch origin
git checkout -b release_v20190614 origin/release_v20190614
Step . Review the changes locally Step . Merge the branch and fix any conflicts that come up git checkout release
git merge --no-ff release_v20190614
Step . Push the result of the merge to GitLab git push origin release
附windows下,使用gitlab提交代码完整步骤
1.安装git客户端,并配置环境变量
C:\Program Files\Git\cmd;C:\Program Files\Git\usr\bin;
2.在本机创建ssh-key
#jenkins
ssh-keygen -t rsa -C "jenkins@vcredit.com" -b
3.配置ssh-keys在git服务器上
a)复制密钥
type %userprofile%\.ssh\id_rsa.pub | clip
b)在gitlib服务器上添加密钥
setting->SSH Keys->粘贴密钥到Key->Add key
4.git提交代码示例
示例1
git clone http://10.138.61.75/test/my-test.git
cd my-test
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
示例2
echo "# spring-boot-apollo-demo" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/lixyu/spring-boot-apollo-demo.git
git push -u origin master
5.How to add your SSH key to Eclipse: https://wiki.eclipse.org/EGit/User_Guide#Eclipse_SSH_Configuration
6.git配置
git config --global user.name "your name"
git config --global user.email "your email"
7.git强制更新并覆盖本地代码
git fetch --all git reset --hard origin/master git pull
8.其他