从git克隆回购后该怎么办 [英] What to do after cloning repo from git

查看:148
本文介绍了从git克隆回购后该怎么办的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是一个 git入门,基本上我克隆了一个git存储库,现在我想提交在文件中所做的更改.当我运行命令git commit时说not a git repository

I am just a git starter, basically I clone a git repository and now I wanted to commit the changes that I made in a file. when I run the command git commit it says not a git repository,

因此,作为git的入门者,我只是想问我是否需要先运行此命令-git init然后是git commit?还是在执行这些步骤之后再提交文件?

So being a starter in git i just wanted to ask that do i need to run this command first - git init and then git commit? Or in between these some more steps to follow to commit the file?

我需要在Bitbucket上提交文件.

I need to commit files on Bitbucket.

屏幕截图-

推荐答案

正如 jeremyharris 所说,在线图书,在那里您可以快速掌握基础知识.

As jeremyharris said, the git documentation site and especially the online book there will get you up to speed on the basics.

一些简短的说明,可能使您摆脱最初的问题.

A few quick notes that might get you past your initial issue.

git clone命令用于从现有git存储库中提取副本(克隆).默认情况下,它将在您执行该文件夹的文件夹中创建一个文件夹,其中包含.git文件夹.克隆创建的文件夹是您的工作副本,而.git文件夹是您的存储库本地副本.

git clone command is used to pull a copy (a clone) from an existing git repository. By default it creates a folder in the folder you execute it from that has a .git folder in it. The folder the cloning creates is your working copy and the .git folder is your local copy of the repository.

git clone与大多数其他git命令不同.所有(或大多数?)其他git命令都要求该命令在克隆创建的工作副本文件夹中执行. (裸存储库有所不同,因为它们没有工作副本,但这在这里不适用.)因此,在做完之后:

git clone is different than most other git commands. All (or most?) other git commands require the command to be executed within the working copy folder created by the clone. (Bare repositories are a bit different since they don't have working copies, but that shouldn't apply here.) So, after doing:

$ git clone <remote repo> <repo name> 

这样做:

$ cd <repo name>

在执行任何其他命令之前进入工作副本.在工作文件夹之外执行命令会显示not a git repository消息.

to get into the working copy before executing any other commands. Executing commands outside of the working folder will get you the not a git repository message.

对文件进行更改后,git add <filename>将其添加到索引(标记为表明已准备好提交),然后git commit -m '<commit message>'将提交更改.

After making a change to a file, git add <filename> adds it to the index (marked to indicate ready to commit) and git commit -m '<commit message>' will then commit the changes.

这篇关于从git克隆回购后该怎么办的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆