flyer@revit MINGW64 /d/javaproject
$ ls
gitstore/
flyer@revit MINGW64 /d/javaproject
$ cd gitstore/
flyer@revit MINGW64 /d/javaproject/gitstore
$ git clone [email protected]:130XXXXX63/bimXXXXXXb.git
Cloning into 'bimatrixweb'...
The authenticity of host 'code.aliyun.com (120.55.150.20)' can't be established.
RSA key fingerprint is SHA256:ZrA2ZqYTVyPbw4zytCSAv74ZMaS2LDH74I7sMPtQIG0.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'code.aliyun.com,120.55.150.20' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
flyer@revit MINGW64 /d/javaproject/gitstore
$ git init
Initialized empty Git repository in D:/javaproject/gitstore/.git/
flyer@revit MINGW64 /d/javaproject/gitstore (master)
$ git config
usage: git config []
Config file location
--global use global config file
--system use system config file
--local use repository config file
-f, --file use given config file
--blob read config from given blob object
Action
--get get value: name [value-regex]
--get-all get all values: key [value-regex]
--get-regexp get values for regexp: name-regex [value-regex]
--get-urlmatch get value specific for the URL: section[.var] URL
--replace-all replace all matching variables: name value [value_regex]
--add add a new variable: name value
--unset remove a variable: name [value-regex]
--unset-all remove all matches: name [value-regex]
--rename-section rename section: old-name new-name
--remove-section remove a section: name
-l, --list list all
-e, --edit open an editor
--get-color find the color configured: slot [default]
--get-colorbool find the color setting: slot [stdout-is-tty]
Type
--bool value is "true" or "false"
--int value is decimal number
--bool-or-int value is --bool or --int
--path value is a path (file or directory name)
Other
-z, --null terminate values with NUL byte
--name-only show variable names only
--includes respect include directives on lookup
--show-origin show origin of config (file, standard input, blob, command line)
flyer@revit MINGW64 /d/javaproject/gitstore (master)
$ git config -1
error: unknown switch `1'
usage: git config []
Config file location
--global use global config file
--system use system config file
--local use repository config file
-f, --file use given config file
--blob read config from given blob object
Action
--get get value: name [value-regex]
--get-all get all values: key [value-regex]
--get-regexp get values for regexp: name-regex [value-regex]
--get-urlmatch get value specific for the URL: section[.var] URL
--replace-all replace all matching variables: name value [value_regex]
--add add a new variable: name value
--unset remove a variable: name [value-regex]
--unset-all remove all matches: name [value-regex]
--rename-section rename section: old-name new-name
--remove-section remove a section: name
-l, --list list all
-e, --edit open an editor
--get-color find the color configured: slot [default]
--get-colorbool find the color setting: slot [stdout-is-tty]
Type
--bool value is "true" or "false"
--int value is decimal number
--bool-or-int value is --bool or --int
--path value is a path (file or directory name)
Other
-z, --null terminate values with NUL byte
--name-only show variable names only
--includes respect include directives on lookup
--show-origin show origin of config (file, standard input, blob, command line)
flyer@revit MINGW64 /d/javaproject/gitstore (master)
$ git config -l
core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
http.sslcainfo=d:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
diff.astextplain.textconv=astextplain
rebase.autosquash=true
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.required=true
credential.helper=manager
user.name=albertflyer
[email protected]
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
flyer@revit MINGW64 /d/javaproject/gitstore (master)
$ cat ~/.ssh/id_rsa.pub
cat: /c/Users/flyer/.ssh/id_rsa.pub: No such file or directory
flyer@revit MINGW64 /d/javaproject/gitstore (master)
$ ssh-keygen -t rsa -C "[email protected]"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/flyer/.ssh/id_rsa): cat ~/.ssh/id_rsa.pub
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Passphrases do not match. Try again.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Saving key "cat ~/.ssh/id_rsa.pub" failed: No such file or directory
flyer@revit MINGW64 /d/javaproject/gitstore (master)
$ cat ~/.ssh/id_rsa.pub
cat: /c/Users/flyer/.ssh/id_rsa.pub: No such file or directory
flyer@revit MINGW64 /d/javaproject/gitstore (master)
$ ssh-keygen -t rsa -C "[email protected]"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/flyer/.ssh/id_rsa): /c/Users/flyer/.ssh/id_rsa)
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Passphrases do not match. Try again.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/flyer/.ssh/id_rsa).
Your public key has been saved in /c/Users/flyer/.ssh/id_rsa).pub.
The key fingerprint is:
SHA256:0ENhm/sJOWqyUpuLkGzqXNVux+sAe4JkariID3lEozg [email protected]
The key's randomart image is:
+---[RSA 2048]----+
| +. |
| + o |
| o . = |
|.o . .. + |
|E .o o .S |
|o=+ + +..+ . |
|*=.+.=o= oo |
|B=o.o++ o . |
|*+o.o. .o |
+----[SHA256]-----+
flyer@revit MINGW64 /d/javaproject/gitstore (master)
/c/Users/flyer/.ssh/id_rsa 是存放key地址的路径
flyer@revit MINGW64 /d/javaproject/gitstore (master)
$ cat ~/.ssh/id_rsa.pub
cat: /c/Users/flyer/.ssh/id_rsa.pub: No such file or directory
flyer@revit MINGW64 /d/javaproject/gitstore (master)
$ cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDNhR8o49RttSMQ+pIfeXLc3+0DftN5Qhyx1/xvQnpWlp8OuDlP+DtEkxNe14kBTBZobzbt4A3wtNRJ7kutbQebHPIuyBGD/FKmNBJS97g3u1Qw2U0vaNyiKVwUAB23fVN+cLFeQuJPUipf6cQMCD4Rvm2E8RlUg4vxyceHfdPKBXHhhVmD1iKPmhvw9fm1XNihQDS3ZT4on9swiW8ZpBALfXa+ixCgP7EUb0dD2pCPbtCW9mHhMf4SBy6+2Nih6Eur057MNvpKN9vVa1xCSbVUZ5b8PAQ4g1 [email protected]
flyer@revit MINGW64 /d/javaproject/gitstore (master)
$ git clone [email protected]:137XXXX163/bimatrixweb.git
Cloning into 'bimatrixweb'...
remote: Counting objects: 15, done
remote: Finding sources: 100% (15/15)
remote: Total 15 (delta 2), reused 15 (delta 2)
Receiving objects: 100% (15/15), 18.63 KiB | 0 bytes/s, done.
Resolving deltas: 100% (2/2), done.
flyer@revit MINGW64 /d/javaproject/gitstore (master)
$ ls
bimatrixweb/
flyer@revit MINGW64 /d/javaproject/gitstore (master)
$ cd bimatrixweb/
flyer@revit MINGW64 /d/javaproject/gitstore/bimatrixweb (master)
$ echo some content >> 需求文档编写计划.txt
flyer@revit MINGW64 /d/javaproject/gitstore/bimatrixweb (master)
$ git add
Nothing specified, nothing added.
Maybe you wanted to say 'git add .'?
flyer@revit MINGW64 /d/javaproject/gitstore/bimatrixweb (master)
$ git add.
git: 'add.' is not a git command. See 'git --help'.
Did you mean this?
add
flyer@revit MINGW64 /d/javaproject/gitstore/bimatrixweb (master)
$ git add .
warning: LF will be replaced by CRLF in 需求文档编写计划.txt.
The file will have its original line endings in your working directory.
flyer@revit MINGW64 /d/javaproject/gitstore/bimatrixweb (master)
$ git commit -m "add some new content."
[master 4dbfa1e] add some new content.
1 file changed, 1 insertion(+)
flyer@revit MINGW64 /d/javaproject/gitstore/bimatrixweb (master)
$ git push
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 298 bytes | 0 bytes/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2)
remote: Updating references: 100% (1/1)
To code.aliyun.com:13701969163/bimatrixweb.git
f5d1ccf..4dbfa1e master -> master
flyer@revit MINGW64 /d/javaproject/gitstore/bimatrixweb (master)
已经推送到远程
http://blog.csdn.net/albertfly/article/details/53812469
参考 :https://code.aliyun.com/help/ssh/README
SSH key 可以让你在你的电脑和Code服务器之间建立安全的加密连接。 先执行以下语句来判断是否已经存在本地公钥:
cat ~/.ssh/id_rsa.pub
如果你看到一长串以 ssh-rsa
或 ssh-dsa
开头的字符串, 你可以跳过 ssh-keygen
的步骤。
提示: 最好的情况是一个密码对应一个ssh key,但是那不是必须的。你完全可以跳过创建密码这个步骤。请记住设置的密码并不能被修改或获取。
你可以按如下命令来生成ssh key:
ssh-keygen -t rsa -C "[email protected]"
这个指令会要求你提供一个位置和文件名去存放键值对和密码,你可以点击Enter键去使用默认值。
用以下命令获取你生成的公钥:
cat ~/.ssh/id_rsa.pub
复制这个公钥放到你的个人设置中的SSH/My SSH Keys下,请完整拷贝从ssh-
开始直到你的用户名和主机名为止的内容。
如果打算拷贝你的公钥到你的粘贴板下,请参考你的操作系统使用以下的命令:
Windows:
clip < ~/.ssh/id_rsa.pub
Mac:
pbcopy < ~/.ssh/id_rsa.pub
GNU/Linux (requires xclip):
xclip -sel clip < ~/.ssh/id_rsa.pub
如何在Eclipse中添加ssh key: https://wiki.eclipse.org/EGit/User_Guide#Eclipse_SSH_Configuration
如果,不管你有什么理由,当你决定去用一个非默认的位置或文件名去存放你的ssh key。你必须配置好你的ssh客户端以找到你的ssh私钥去连接Code服务器,对于OpenSSH客户端,这个通常是在~/.ssh/config
类似的位置配置的:
#
# Our company's internal GitLab server
#
Host my-git.company.com
RSAAuthentication yes
IdentityFile ~/my-ssh-key-directory/company-com-private-key-filename