【Git】 IDEA上传华为云

IDEA上传华为云

  • 1 创建本地仓库
    git init
    在这里插入图片描述

  • 2 设置提交代码时的用户信息
    git config --global user.name "[name]"
    git config --global user.email "[email address]"
    例如:git config --global user.name “xxx@163.com”
    git config --global user.email “xxx@163.com”

  • 3 提交到本地库
    方式1:
    git status ----显示有变更的文件
    git add . ----添加当前目录的所有文件到暂存区
    git add [dir] ----添加指定目录到暂存区,包括子目录
    例如:git add pom.xml
    git commit -m [message] ----提交暂存区到仓库区
    例如:git commit -m “初始化项目”
    方式2:
    在这里插入图片描述

  • 4 增加一个新的远程仓库,并命名
    git remote add huawei [url]
    url为远程仓库的地址

  • 5 设置公钥
    ssh-keygen -t rsa -C [name]
    例如:ssh-keygen -t rsa -C “xxx@163.com”

  • 6 将目录下的公钥写入到剪切板
    clip < ~/.ssh/id_rsa.pub

  • 7 在远程库设置公钥

  • 8 将代码提交到远程库
    git push huawei master

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要将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远程仓库的详细信息。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值