gitee项目备份管理

qujing@qujingj-PC MINGW64 ~
$ git config --global user.name "windsondxpc"

qujing@qujingj-PC MINGW64 ~
$ git config --global user.email "228966994@qq.com"


qujing@qujingj-PC MINGW64 ~
$ ssh-keygen -t rsa -C "228966994@qq.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/qujing/.ssh/id_rsa):
Created directory '/c/Users/qujing/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/qujing/.ssh/id_rsa.
Your public key has been saved in /c/Users/qujing/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:mKMDq3+MMFdDIjkBsRdq37AdW3VpoNq41o1MctVHVS0 228966994@qq.com
The key's randomart image is:
+---[RSA 2048]----+
|=+.      o......+|
|+o...   o oo. E .|
|o+.+ . o ... . . |
|... B Bo.   .    |
|  .+ O++S        |
|o .o .B.o        |
| +.ooo + .       |
| .. +.           |
|....             |
+----[SHA256]-----+

qujing@qujingj-PC MINGW64 ~
$

https://gitee.com/profile/sshkeys
添加个人公钥注意这里的公钥

进行远程连接

$ pwd
/c/Users/qujing

qujing@qujingj-PC MINGW64 ~
$ mkdir dxcloud

qujing@qujingj-PC MINGW64 ~
$ cd dxcloud/

qujing@qujingj-PC MINGW64 ~/dxcloud
$ ls

qujing@qujingj-PC MINGW64 ~/dxcloud
$ git init
Initialized empty Git repository in C:/Users/qujing/dxcloud/.git/

qujing@qujingj-PC MINGW64 ~/dxcloud (master)
$ git remote add origin git@gitee.com:windsred/firecloud.git

qujing@qujingj-PC MINGW64 ~/dxcloud (master)



#如下为参考命令不是实际输入
git remote -v查看远程库信息:
git remote rm origin删除已有的GitHub远程库:

修改说明文件测试


qujing@qujingj-PC MINGW64 ~/dxcloud (master) $ git push origin master Enumerating objects: 5, done. Counting objects: 100% (5/5), done. Delta compression using up to 8 threads Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 276 bytes | 276.00 KiB/s, done. Total 3 (delta 1), reused 0 (delta 0) remote: Powered by Gitee.com To gitee.com:windsred/firecloud.git 020ac69..6cec3e6 master -> master qujing@qujingj-PC MINGW64 ~/dxcloud (master) $ ls README.md qujing@qujingj-PC MINGW64 ~/dxcloud (master) $ vim README.md qujing@qujingj-PC MINGW64 ~/dxcloud (master) $ ls README.md qujing@qujingj-PC MINGW64 ~/dxcloud (master) $ git commit -m "xiugai" On branch master Changes not staged for commit: modified: README.md no changes added to commit qujing@qujingj-PC MINGW64 ~/dxcloud (master) $ git add README.md qujing@qujingj-PC MINGW64 ~/dxcloud (master) $ git commit -m "xiugai" [master 6cec3e6] xiugai 1 file changed, 2 insertions(+), 2 deletions(-) qujing@qujingj-PC MINGW64 ~/dxcloud (master) $ git push origin master Enumerating objects: 5, done. Counting objects: 100% (5/5), done. Delta compression using up to 8 threads Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 276 bytes | 276.00 KiB/s, done. Total 3 (delta 1), reused 0 (delta 0) remote: Powered by Gitee.com To gitee.com:windsred/firecloud.git 020ac69..6cec3e6 master -> master qujing@qujingj-PC MINGW64 ~/dxcloud (master) $ ls README.md

注释:

$ git push origin

上面命令表示,将当前分支推送到origin主机的对应分支。 

如果当前分支只有一个追踪分支,那么主机名都可以省略。 

$ git push 如果当前分支与多个主机存在追踪关系,那么这个时候-u选项会指定一个默认主机,这样后面就可以不加任何参数使用git push。

$ git push -u origin master 上面命令将本地的master分支推送到origin主机,同时指定origin为默认主机,后面就可以不加任何参数使用git push了。

 不带任何参数的git push,默认只推送当前分支,这叫做simple方式。此外,还有一种matching方式,会推送所有有对应的远程分支的本地分支。Git 2.0版本之前,默认采用matching方法,现在改为默认采用simple方式。
分类: 未分类

发表评论

电子邮件地址不会被公开。 必填项已用*标注