github添加远程库和本地库同步操作



Administrator@hsgpc MINGW32 /
$ pwd
/


Administrator@hsgpc MINGW32 /
$ cd hsg
bash: cd: hsg: No such file or directory


Administrator@hsgpc MINGW32 /
$ cd hsg77


Administrator@hsgpc MINGW32 /hsg77 (master)
$ cd HelloWorld


Administrator@hsgpc MINGW32 /hsg77/HelloWorld (master)
$ pwd
/hsg77/HelloWorld
l
Administrator@hsgpc MINGW32 /hsg77/HelloWorld (master)
$ ls
LICENSE.txt  readme.txt


Administrator@hsgpc MINGW32 /hsg77/HelloWorld (master)
$ ssh-keygen -t rsa -C "hsg77@163.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/Administrator/.ssh/id_rsa): .ssh/id_rsa
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Saving key ".ssh/id_rsa" failed: No such file or directory


Administrator@hsgpc MINGW32 /hsg77/HelloWorld (master)
$ mkdir .ssh


Administrator@hsgpc MINGW32 /hsg77/HelloWorld (master)
$ pwd
/hsg77/HelloWorld


Administrator@hsgpc MINGW32 /hsg77/HelloWorld (master)
$ ls
LICENSE.txt  readme.txt


Administrator@hsgpc MINGW32 /hsg77/HelloWorld (master)
$ ssh-keygen -t rsa -C "hsg77@163.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/Administrator/.ssh/id_rsa): /.ssh/id_rsa
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Saving key "/.ssh/id_rsa" failed: No such file or directory


Administrator@hsgpc MINGW32 /hsg77/HelloWorld (master)
$ ssh-keygen help
Too many arguments.
usage: ssh-keygen [-q] [-b bits] [-t dsa | ecdsa | ed25519 | rsa | rsa1]
                  [-N new_passphrase] [-C comment] [-f output_keyfile]
       ssh-keygen -p [-P old_passphrase] [-N new_passphrase] [-f keyfile]
       ssh-keygen -i [-m key_format] [-f input_keyfile]
       ssh-keygen -e [-m key_format] [-f input_keyfile]
       ssh-keygen -y [-f input_keyfile]
       ssh-keygen -c [-P passphrase] [-C comment] [-f keyfile]
       ssh-keygen -l [-v] [-E fingerprint_hash] [-f input_keyfile]
       ssh-keygen -B [-f input_keyfile]
       ssh-keygen -D pkcs11
       ssh-keygen -F hostname [-f known_hosts_file] [-l]
       ssh-keygen -H [-f known_hosts_file]
       ssh-keygen -R hostname [-f known_hosts_file]
       ssh-keygen -r hostname [-f input_keyfile] [-g]
       ssh-keygen -G output_file [-v] [-b bits] [-M memory] [-S start_point]
       ssh-keygen -T output_file -f input_file [-v] [-a rounds] [-J num_lines]
                  [-j start_line] [-K checkpt] [-W generator]
       ssh-keygen -s ca_key -I certificate_identity [-h] [-n principals]
                  [-O option] [-V validity_interval] [-z serial_number] file ...
       ssh-keygen -L [-f input_keyfile]
       ssh-keygen -A
       ssh-keygen -k -f krl_file [-u] [-s ca_public] [-z version_number]
                  file ...
       ssh-keygen -Q -f krl_file file ...


Administrator@hsgpc MINGW32 /hsg77/HelloWorld (master)
$ ssh-keygen -t rsa -C "hsg77@163.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/Administrator/.ssh/id_rsa):
Created directory '/c/Users/Administrator/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/Administrator/.ssh/id_rsa.
Your public key has been saved in /c/Users/Administrator/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:qvNXY2LsDtt4JxWoS4k0pUSkH37SfgQbDToRCbEPokk hsg77@163.com
The key's randomart image is:
+---[RSA 2048]----+
|  o==o.          |
|   ooo.o         |
|.E+.+oo ..       |
|oo =++ +. .      |
|o  .=o++S  .     |
|    .++o+ =      |
|     .++.= .     |
|    ...*= .      |
|    .o++oo       |
+----[SHA256]-----+


Administrator@hsgpc MINGW32 /hsg77/HelloWorld (master)
$ git remote add origin git@github.com:hsg77/HelloWorld.git


Administrator@hsgpc MINGW32 /hsg77/HelloWorld (master)
$ git push -u origin master
The authenticity of host 'github.com (192.30.252.128)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.252.128' (RSA) to the list of known hosts.
To git@github.com:hsg77/HelloWorld.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'git@github.com:hsg77/HelloWorld.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.


Administrator@hsgpc MINGW32 /hsg77/HelloWorld (master)
$ git push -u origin master
To git@github.com:hsg77/HelloWorld.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'git@github.com:hsg77/HelloWorld.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.


Administrator@hsgpc MINGW32 /hsg77/HelloWorld (master)
$ git push --help
Launching default browser to display HTML ...


Administrator@hsgpc MINGW32 /hsg77/HelloWorld (master)
$ git pull --rebase origin master
warning: no common commits
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 4 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (4/4), done.
From github.com:hsg77/HelloWorld
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> origin/master
First, rewinding head to replay your work on top of it...
Applying: wrote a readme file
Applying: add distributed
Applying: append GPL
Applying: understand how stage works
Applying: git tracks changes
Applying: of file
Applying: add test.txt
Applying: remove test.txt


Administrator@hsgpc MINGW32 /hsg77/HelloWorld (master)
$ git push -u origin master
Counting objects: 23, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (21/21), done.
Writing objects: 100% (23/23), 1.94 KiB | 0 bytes/s, done.
Total 23 (delta 9), reused 0 (delta 0)
To git@github.com:hsg77/HelloWorld.git
   902d3c6..77ad495  master -> master
Branch master set up to track remote branch master from origin.


Administrator@hsgpc MINGW32 /hsg77/HelloWorld (master)
$ ls
LICENSE  LICENSE.txt  readme.txt


Administrator@hsgpc MINGW32 /hsg77/HelloWorld (master)
$


Administrator@hsgpc MINGW32 /hsg77/HelloWorld (master)
$ pwd
/hsg77/HelloWorld


Administrator@hsgpc MINGW32 /hsg77/HelloWorld (master)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值