阿里云Linux使用git方法

git init初始化.仓库.

SSH方式.上传.(重点.)

(2020-2-9 23:42:58)

官方教学一

教学二

重点命令(2020-2-9 23:44:52)

git remote set-url origin [email protected]:**/**.git

更改.url.(2020-2-9 23:46:33)

简易的命令行入门教程:
Git 全局设置:

git config --global user.name "***"
git config --global user.email "***@qq.com"
创建 git 仓库:

mkdir ***
cd ***
git init
touch README.md
git add README.md
git commit -m "first commit"
git remote add origin [email protected]:***/***.git
git push -u origin master
已有仓库?

cd existing_git_repo
git remote add origin [email protected]:***/***.git
git push -u origin master

新建无readme.md的新仓库.出现此教程.gitee.
(2020-2-9 23:49:06)

加SSH钥匙的地方.

https://gitee.com/keys

良好.资料.(2020-2-10 0:46:14)

过程.拷贝.与.处理

(2020-2-10 0:59:02)

[root@*** ~]# ssh-keygen -t rsa -C "***@qq.com"

Generating public/private rsa key pair.

Enter file in which to save the key (/root/.ssh/id_rsa): 

Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 

Your identification has been saved in /root/.ssh/id_rsa.

Your public key has been saved in /root/.ssh/id_rsa.pub.

The key fingerprint is:
6a:14:18:ab:cc:c2:37:bd:d8:a3:b2:73:13:90:a3:fe ***@qq.com
The key's randomart image is:
+--[ RSA 2048]----+
|    .            |
|     +           |
|  . o .          |
|.* ..  .         |
|o.*o .. S        |
|....+...         |
|.  ..+o          |
| + o...          |
| .*E.            |
+-----------------+
[root@*** ~]# cat ~/.ssh/id_rsa.pub
查看.

[root@*** ~]# ssh -T [email protected]
The authenticity of host 'gitee.com (180.97.125.228)' can't be established.
RSA key fingerprint is e3:ee:82:78:fb:c0:ca:24:65:69:ba:bc:47:24:6f:d4.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'gitee.com,180.97.125.228' (RSA) to the list of known hosts.
Enter passphrase for key '/root/.ssh/id_rsa': 
Permission denied (publickey).

[root@*** ~]# ssh -T [email protected]
Enter passphrase for key '/root/.ssh/id_rsa': 
Hi ***! You've successfully authenticated, but GITEE.COM does not provide shell access.
[root@*** ~]# git push -u origin master
error: The requested URL returned error: 401 Unauthorized while accessing https://gitee.com/***/***.git/info/refs

fatal: HTTP request failed
发布了90 篇原创文章 · 获赞 20 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/gwdfff/article/details/104242612