博客> git 配置
git 配置
2019-11-13 04:39 评论:0 阅读:45 914345202
ios git 配置

//1. 配置git $ git config --global user.name 'xxxx' $ git config --global user.email 'xxx@xx.com' //2.ssh $ sssh-keygen -t rsa -C "xxxxx@xxxxx.com"

Generating public/private rsa key pair..

cat ~/.ssh/id_rsa.pub

ssh-rsa AAAAB2EAAAADAQQC6eNtGpNGwstc....

ssh -T git@gitee.com

首次使用需要确认并添加主机到本机SSH可信列表。若返回 Hi XXX! You've successfully authenticated, but Gitee.com does not provide shell access. 内容,则证明添加成功。

//2.初始化git 关联本地和远程。(git用法: add. commit -- pull --push) $ git init (rm -rf .git) 初始化git (删除git文件)

$ git add . $ git commit -m'first commit' (创建本地 master分支)

$ git remote add origin git@gitee.com:git_tangqiong/FeiCuiFangLiveRepo.git (创建远程分支)

$ git pull --rebase origin master(拉取git上的文件) //只要pull 就会查看到远程分支,将远程文件 /拉去下来如果远程没有文件,则直接进入下一步 /** 如果不进行此操作,直接push,会报此错 ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'git@gitee.com:git_tangqiong/FeiCuiFangLiveRepo.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.

*/ $ git push -u origin master      第一次使用加上了-u参数,是推送内容并关联分支 $ git push --set-upstream origin master $ git branch --set-upstream-to=origin/ master

//3.查看分支 $ git branch

* master 本地分支

$ git branch -a

* master 本地分支

remotes/origin/master 远程分支

$ git branch -r

origin/master 远程分支

收藏
0
sina weixin mail 回到顶部