Git -- 创建一个远程git仓库和做初始化"push"
来源:互联网 发布:淘宝静物拍照 编辑:程序博客网 时间:2024/04/25 15:08
Origin: http://thelucid.com/2008/12/02/git-setting-up-a-remote-repository-and-doing-an-initial-push/
There is loads of documentation and posts on Git out there so thisis more of a note to self as I keep forgetting the steps to setting upa remote repository and doing an initial ‘push’.
So, firstly setup the remote repository:
ssh git@example.commkdir my_project.gitcd my_project.gitgit init --baregit-update-server-info # If planning to serve via HTTPexit
On local machine:
cd my_projectgit initgit add *git commit -m "My initial commit message"git remote add origin git@example.com:my_project.gitgit push origin master
Done!
Team members can now clone and track the remote repository using the following:
git clone git@example.com:my_project.gitcd my_projectgit-track origin
Note: the ‘git-track’ command is a bash function we use to savemanually editing the .git/config file (add the following to your~/.bash_profile fileas outlined by darkliquid):
function parse_git_branch { git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'}function git-track { CURRENT_BRANCH=$(parse_git_branch) git-config branch.$CURRENT_BRANCH.remote $1 git-config branch.$CURRENT_BRANCH.merge refs/heads/$CURRENT_BRANCH}
h4. Bonus
To have your terminal prompt display what branch you are currently on in green, add the following to your ~/.bash_profile:
function parse_git_branch_and_add_brackets { git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\ \[\1\]/'}PS1="\h:\W \u\[\033[0;32m\]\$(parse_git_branch_and_add_brackets) \[\033[0m\]\$ "
---------------------------
git config --global user.name "Your Name"
git config --global user.email you@example.com
- Git -- 创建一个远程git仓库和做初始化"push"
- git remote 创建一个远程仓库,并做merge
- 创建git仓库和初始化仓库
- git 创建远程仓库
- git 创建远程仓库
- git创建远程仓库
- git 创建远程仓库
- git 创建远程仓库
- git-创建远程仓库
- git 创建远程仓库
- 创建Git远程仓库
- git 创建远程仓库
- git创建远程仓库
- 第一次创建本地git仓库以后push到远程库报错
- 创建局域网内远程git仓库,并将本地仓库push推到远程仓库中
- 创建局域网内远程git仓库,并将本地仓库push推到远程仓库中
- Git 远程仓库——关联和push和clone
- git 远程仓库创建和代码上传
- 熬不尽的IT江湖
- java 读文件的几种方法(一)
- _tcstok函数的使用
- 《华为研发》阅读 - 25 (预研)
- oracle 11G exp导出,空表导不出表结构的解决办法..
- Git -- 创建一个远程git仓库和做初始化"push"
- TypeError: Error #1034: 强制转换类型失败:无法将 ...
- js 没有权限
- Android--SQLite数据库应用技巧分享
- iPhone ipa 软件破解工具 PoedCrack 使用教程
- Silverlight MMORPG网页游戏开发课程[一期] 第一课:控制对象移动
- Performance Counters CPU使用率等
- JAVA环境搭建及运行
- 基于Jmeter开发性能自动化测试平台