Python—将PyCharm中的代码提交在Gitee码云的方法
<p><span style="font-size: 18px"><strong>第一步:去Gitee码云登录/注册一个账号</strong></span></p><p><span style="font-size: 18px"><strong> </strong></span><span style="font-size: 15px">将进入主页后右上角有几个加号,选择新建仓库</span></p>
<p><span style="font-size: 18px"><strong> <img src="https://img2020.cnblogs.com/blog/1784913/202010/1784913-20201004163102818-806804695.png" alt="" loading="lazy"></strong></span></p>
<p> </p>
<p> <span style="font-size: 18px"><strong>第二步:填写信息点击创建</strong></span></p>
<p><span style="font-size: 18px"><strong><img src="https://img2020.cnblogs.com/blog/1784913/202010/1784913-20201004163711603-194229151.png" alt="" loading="lazy"></strong></span></p>
<p><span style="font-size: 18px"><strong> 第三步:下载并安装Git</strong></span></p>
<p> </p>
<p> Git的下载与安装:https://www.cnblogs.com/jiekesi/p/13767796.html</p>
<p> </p>
<p><span style="font-size: 16px"><strong>第四步:将Gitee码云的仓库克隆下来</strong></span></p>
<p><span style="font-size: 16px"><strong> 1.新建一个文件夹 右击点击 git Bash Here 弹出命令框</strong></span></p>
<p><span style="font-size: 16px"><strong> <img src="https://img2020.cnblogs.com/blog/1784913/202010/1784913-20201004204734456-1698871294.png" alt="" loading="lazy"></strong></span></p>
<p> <strong>2<span style="font-size: 16px">.从<strong>Gitee码云的仓库</strong>复制你的云端链接</span></strong></p>
<p> </p>
<p> </p>
<p><strong><span style="font-size: 16px"> <img src="https://img2020.cnblogs.com/blog/1784913/202010/1784913-20201004205020858-902253917.png" alt="" loading="lazy"></span></strong></p>
<p> </p>
<p> </p>
<p> <span style="font-size: 16px"><strong>3.在命令中输入:git clone 链接</strong></span></p>
<p><span style="font-size: 16px"><strong> <img src="https://img2020.cnblogs.com/blog/1784913/202010/1784913-20201004205155627-1199479647.png" alt="" loading="lazy"></strong></span></p>
<p> </p>
<p> </p>
<p> <span style="font-size: 16px"><strong>4.输入你码云的用户名与密码</strong></span></p>
<p> <span style="font-size: 16px"><strong><img src="https://img2020.cnblogs.com/blog/1784913/202010/1784913-20201004205556341-456244365.png" alt="" loading="lazy"></strong></span></p>
<p> </p>
<p> </p>
<p> <span style="font-size: 16px"><strong>5.打开PyCharm</strong></span></p>
<p><span style="font-size: 16px"><strong> </strong>这时文件就已经克隆到你新建的文件夹下,</span><span style="font-size: 16px">用Pycharm打开这个路径</span></p>
<p><span style="font-size: 16px"> <img src="https://img2020.cnblogs.com/blog/1784913/202010/1784913-20201004210355815-444588557.png" alt="" loading="lazy"></span></p>
<p><span style="font-size: 16px"> 当你点击打开.gitignore这个文件时或创建文件时,会提示你是否提交到暂存区。选择是就可以了</span></p>
<p><span style="font-size: 16px"> <img src="https://img2020.cnblogs.com/blog/1784913/202010/1784913-20201004210543958-1103173023.png" alt="" loading="lazy"></span></p>
<p> </p>
<p> <span style="font-size: 16px"><strong>6.在Git控制面板中进行这个目录下</strong></span></p>
<p> <img src="https://img2020.cnblogs.com/blog/1784913/202010/1784913-20201004210822751-1362703442.png" alt="" loading="lazy"></p>
<p> </p>
<p> </p>
<p><span style="font-size: 16px"><strong>第四步:将写好的文件提交到云端</strong></span></p>
<p><span style="font-size: 16px"><strong> 1.命令行中输入:git status 查看当前工作状态</strong></span></p>
<p><span style="font-size: 16px"><strong> 文件是红色的要么是修改了文件或则没提交到暂存区的</strong></span></p>
<p> <img src="https://img2020.cnblogs.com/blog/1784913/202010/1784913-20201004211352971-1505217168.png" alt="" loading="lazy"></p>
<p><span style="font-size: 16px"><strong> 2.将写好的文件提交到暂存区: git add .</strong></span></p>
<p><span style="font-size: 16px"><strong> <strong>交到暂存区后</strong>在查看工作状态,文件就变为绿色了</strong></span></p>
<p><span style="font-size: 16px"><strong> <img src="https://img2020.cnblogs.com/blog/1784913/202010/1784913-20201004211928011-833840488.png" alt="" loading="lazy"></strong></span></p>
<p><span style="font-size: 16px"><strong> 3.提交到本地仓库:git commit -m "文件描述"</strong></span></p>
<p><span style="font-size: 16px"><strong> 在第一次提交时必须,填写用户名和邮箱 git user.name 和 git user.emile。在次提交</strong></span></p>
<p> git config user.name "用户名" git config user.email "taozuixi@163.com"</p>
<p><span style="font-size: 16px"><strong> <img src="https://img2020.cnblogs.com/blog/1784913/202010/1784913-20201004212752477-1519492756.png" alt="" loading="lazy"></strong></span></p>
<p><span style="font-size: 16px"><strong> 4.最后整体提交:git push</strong></span></p>
<p><span style="font-size: 16px"><strong> <img src="https://img2020.cnblogs.com/blog/1784913/202010/1784913-20201004213114955-410758968.png" alt="" loading="lazy"></strong></span></p>
<p> </p>
<p> </p>
<p><span style="font-size: 16px"><strong> 第五步:打开自己的Gitee码云仓库</strong></span></p>
<p><span style="font-size: 16px"><strong> 这时代码已经到码云仓库</strong></span></p>
<p><span style="font-size: 16px"><strong> <img src="https://img2020.cnblogs.com/blog/1784913/202010/1784913-20201004213430233-147371062.png" alt="" loading="lazy"></strong></span></p>
<p>Git的常用命令:</p>
<p> </p>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 0, 0, 1)">git init 初始在文件夹中生成隐藏的.git文件
git clone 地址克隆远程仓库
git clone </span>-<span style="color: rgba(0, 0, 0, 1)">b 分支名 地址 克隆分支的代码到本地
git status查看状态
git add 文件名 将某个文件存入暂存区
git add b c 把b和c存入暂存区
git add .将所有文件提交到暂存区
git add </span>-<span style="color: rgba(0, 0, 0, 1)">p 文件名一个文件分多次提交
git config user.name </span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">提交的用户名</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(0, 0, 0, 1)">
git config user.email </span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">邮箱</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(0, 0, 0, 1)">
git stash </span>-u -k提交部分文件内容 到仓库 例如本地有3个文件 a b c 只想提交a b到远程仓库 git add a b 然后 git stash -u -k 再然后git commit -m <span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">备注信息</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(0, 0, 0, 1)"> 然后再push push之后 git stash pop 把之前放入堆栈的c拿出来 继续下一波操作
git commit </span>-m <span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">提交的备注信息</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(0, 0, 0, 1)"> 提交到仓库
若已经有若干文件放入仓库,再次提交可以不用git add和git commit </span>-m <span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">备注信息</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(0, 0, 0, 1)"> 这2步, 直接用
git commit </span>-am <span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">备注信息</span><span style="color: rgba(128, 0, 0, 1)">"</span>将内容放至仓库 也可用git commit -a -m <span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">备注信息</span><span style="color: rgba(128, 0, 0, 1)">"</span>
* git commit中的备注信息尽量完善 养成良好提交习惯 例如 git commit -m <span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">变更(范围):变更的内容</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(0, 0, 0, 1)">
git push 将本地仓库代码提交到远端仓库
git pull 从远端仓库中更新本地仓库代码
git clone 远端仓库地址</span></pre>
</div>
<p> </p>
<p> </p>
<p> </p><br><br>
来源:https://www.cnblogs.com/jiekesi/p/13767635.html
頁:
[1]