Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
wiki-git
wiki-git
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Operations
    • Operations
    • Incidents
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • 互联网应用开发
  • wiki-gitwiki-git
  • Wiki
  • Home

Last edited by 王秋石 Jun 12, 2016
Page history
This is an old version of this page. You can view the most recent version or browse the history.

Home

安装

  1. windows https://git-for-windows.github.io/
  2. mac https://sourceforge.net/projects/git-osx-installer/
  3. ubuntu sudo apt-get install git

简单使用

  1. 初始化一个目录为git仓库
mkdir my_first_git_rep
cd my_first_git_rep
git init
touch README.md
echo "hello git" >> README.md
git add .
git commit -m readme
  1. 设置公钥

windows用户使用git-bash 执行命令

ssh-keygen -t rsa  

一路默认回车 然后进入用户目录的.ssh文件夹下,复制rsa.pub的内容 到gitlab的设置ssh-key的地方即可

  1. 从服务端获取一个项目,类似 svn co
git clone git@tech.pingansec.com:wangqs/wiki-git.git
  1. 将本地的代码推送到远程
git push origin master
  1. push 出现reject
git pull --rebase origin master
  1. 更新代码
git pull --rebase origin master
  1. 把本地已存在的项目推送到远程
git remote add origin git@tech.pingansec.com:wangqs/wiki-git.git
  1. 创建分支,切换分支
git branch issues999
git checkout issue999
  1. 切换远程分支到本地
git fetch
git checkout branchname
Clone repository
  • Home