windows下git的本地操作库、远程操作库流程!

1、windows下git建立本地仓库

$ git config --global user.name "hehe"
$ git config --global user.email "hehe@163.com"

2、创建密匙

$ ssh-keygen -t rsa -b 4096 -C "hehe@163com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/hehe/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/heheiscool/.ssh/id_rsa.
Your public key has been saved in /c/Users/heheiscool/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:gx8BsPtCRTwoKsD0D+tQeo+XIgl31mzKp6Qw2UrAIlQ heheiscool@163com
The key's randomart image is:
+---[RSA 4096]----+
|o. E.+o |
|..+ .oo. |
|.o =. ... |
|= o += . . |
|*+.o=.= S |
|=+==o+.. o |
|++.+=+o . |
|.+.oo+ |
|. . . |
+----[SHA256]-----+

3、查询创建的ssh秘匙

$ ls -al ~/.ssh
total 28
drwxr-xr-x 1 hehe 197609 0 12月 20 21:57 ./
drwxr-xr-x 1 hehe 197609 0 12月 20 21:45 ../
-rw-r--r-- 1 hehe 197609 3243 12月 20 21:57 id_rsa
-rw-r--r-- 1 hehe 197609 743 12月 20 21:57 id_rsa.pub
-rw-r--r-- 1 hehe 197609 803 12月 18 21:25 known_hosts

4、初始化本地git仓库

$ git init
Initialized empty Git repository in C:/wamp64/www/other/www/.git/

5、把文件添加到仓库

$ git add .
warning: LF will be replaced by CRLF in assets/css/colorpicker.css.
The file will have its original line endings in your working directory.

6、把文件提交到仓库

$ git commit -m "first"
[master 47a15e3] first
warning: LF will be replaced by CRLF in assets/css/colorpicker.css.
The file will have its original line endings in your working directory.

7、把本地库git到远程生成库
hehe@hehe MINGW64 /c/wamp64/www/other/www (master)
$ git remote add origin https://github.com/heheiscool/Keep.git
fatal: remote origin already exists.

8、把本地库文件push到远程建好库中

$ git push -u origin master
Counting objects: 123, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (119/119), done.
Writing objects: 100% (123/123), 1.63 MiB | 29.00 KiB/s, done.
Total 123 (delta 27), reused 0 (delta 0)
remote: Resolving deltas: 100% (27/27), done.
To https://github.com/hehe/Keep.git

  • [new branch] master -> master
    Branch master set up to track remote branch master from origin.

2018-6-28补充几点:
1、从远程库强制覆盖本地库
网上是下面的方法

git fetch --all

git reset --hard origin/master

2、关于pull request(pr)
两个分支:master、develop,develop跟master发送 pr请求,命令操作方式如下:

git clone git@XXXX.com
git checkout master
git pull git@XXXX.com develop
git push origin master

这样本地库master已经被提交pr,再上传到github:

git add .
git commt -m "###"
git push -u origin master

3、创建分支:

git branch newname

切换到分支:

git checkout newname

上传分支:

git push origin newname

远程删除分支

git branch -d newname

转载于:https://blog.51cto.com/13238147/2052725

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值