markdown Git Pull to Deploy

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown Git Pull to Deploy相关的知识,希望对你有一定的参考价值。

#Production Server
##Setup public Key on bitbucket
- Create public key on server `ssh-keygen -f ~/.ssh/bb_deployment_key.rsa -t rsa -b 4096`
- Leave Passphrase empty
- Copy public key `cat ~/.ssh/bb_deployment_key.rsa.pub`
- Add to Bitbucket
- Setup SSH to use this key (since it's a non-standard name)
`nano ~/.ssh/config` and add
```
Host bitbucket.org
  IdentityFile ~/.ssh/bb_deployment_key.rsa
```
- `chmod 600 ~/.ssh/config` (and maybe to other new files)
- can get more fancy with user names [blog article](http://nerderati.com/2011/03/17/simplify-your-life-with-an-ssh-config-file/)

##Git
- `cd` to parent directory
- Clone in repo `git clone git@bitbucket.org:cubesystems/mynew-plugin.git` (makes folder called parent/mynew-plugin)
- Or to specific folder `git clone git@bitbucket.org:cubesystems/mynew-plugin.git specific-folder`

##Updating
- `cd` to repo
- If Changes have been made locally
  - `git fetch origin` - To get the latest changes
  - `git reset --hard origin/master` - To remove any changes that may have been made locally (or ftp'd up for checking)
  - `git status` to check where we're at
  - `rm path/filename` to delete any files that are untracked (and therefore won't be deleted or overwritten by git)
- Or if clean
  - `git pull`
  - 
  
#Errors
##Message about not knowing which branch to merge to on pull
- Under [branch "master"], add the following to the repo's Git config file (.git/config):
```
[branch "master"]
    remote = origin
    merge = refs/heads/master
```
or manually
`git config branch.master.remote origin`
`git config branch.master.merge refs/heads/master`

- This tells Git 2 things:
-- When you're on the master branch, the default remote is origin.
-- When using git pull on the master branch, with no remote and branch specified, use the default remote (origin) and merge in the changes from the master branch.

以上是关于markdown Git Pull to Deploy的主要内容,如果未能解决你的问题,请参考以下文章

git无法pull仓库refusing to merge unrelated histories

git无法pull仓库refusing to merge unrelated histories

git无法pull仓库refusing to merge unrelated histories

问题解决方案git无法pull仓库refusing to merge unrelated histories

git无法pull仓库refusing to merge unrelated histories

git pull error: unable to unlink old (Permission denied)