代码迁移到华为云上和Git的坑

代码迁移到华为云上和Git的坑

先设置小乌龟Git上方式为ssh

参考链接:https://www.liangzl.com/get-article-detail-3586.html

C:\Users\yangf\AppData\Local\Programs\Git\usr\bin\ssh.exe

生成秘钥:

puttygen.exe

添加秘钥:

pageant.exe

把秘钥拷贝到华为云添加SSH秘钥;

然后克隆项目出现:

ssh git  克隆 权限被拒绝(公钥)。 致命:无法从远程存储库读取。 请确保您拥有正确的访问权限 并且存储库已经存在。

删掉   C:\Users\yangf\.ssh   下known_hosts文件即可;

要将Ubuntu上的代码通过Git上传到华为云,您需要进行以下步骤: 1. 在华为云上创建一个Git仓库,获取Git仓库的URL。 2. 在Ubuntu上安装Git,并配置Git用户名和邮箱。 ``` sudo apt-get update sudo apt-get install git git config --global user.name "Your Name" git config --global user.email "youremail@domain.com" ``` 3. 在Ubuntu上使用git clone命令将Git仓库克隆到本地。 ``` git clone git@github.com:username/repo.git ``` 其中,username是您的GitHub用户名,repo是您要克隆的仓库名称。请将其替换为您要克隆的GitHub仓库的URL。 4. 将您的代码复制到克隆的Git仓库中。 ``` cp /path/to/your/code/* /path/to/your/git/repo/ ``` 5. 在Git仓库中添加、提交和推送更改。 ``` git add . git commit -m "add your commit message here" git push origin master ``` 其中,"."表示将所有更改添加到Git仓库中。您可以将其替换为特定的文件或目录。"add your commit message here"是您的提交信息。请将其替换为您自己的提交信息。"origin"是您的Git仓库的别名,"master"是您要推送的分支名称。 6. 输入您的华为云Git仓库的用户名和密码,以完成推送。 ``` Username for 'https://gitee.com': your_username Password for 'https://your_username@gitee.com': your_password ``` 其中,your_username是您的华为云Git仓库的用户名,your_password是您的华为云Git仓库的密码。 7. 检查您的代码是否已成功推送到华为云Git仓库中。 ``` git log git remote -v ``` git log命令将显示您的提交历史记录,git remote -v命令将显示您的Git远程仓库的详细信息。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值