关于git 如何使用提交到github.com的问题,让人十分不解
巴扎黑
巴扎黑 2017-04-26 09:01:43
0
7
786

已经在github.com建立了一个repository,想实现的就是,像SVN提交那样用git到github.com。安装遇到遇到很多问题

1)以下几个必须全部安装吗

(1).git-1.9.4-preview.exe
(2).TortoiseGit 
(3).github.com 官网的 git for windows

似乎是必须三个必须安装,否则就无法使用?为什么非得安装(1)git.exe?库是在远程的
还有第(3)个为什么也必须安装才可以使用?

2)创建的问题,克隆到的目录必须为空?

我已经在github.com上创建了一个 repository,然后我打算将本地的 d:/website/example.com/www(这是DOCUMENT_ROOT) 作为源码目录提交过去,可是 当我当前位置是在 d:/website/example.com 这里的时候,点击克隆。之后却变成了 d:/website/example.com/example.com,然后将位置切换到 d:/website,再克隆,却一直失败,提示目录 d:/website/example.com 不是空目录。
但是我本地已经做好了,难道非得先新建一个空目录,克隆之后,再复制原先已经做好的过去?

3) 右键Git提交->master 必须输入备注信息,否则无法提交?

克隆了之后,把原先做好的源码再粘贴到了目录 d:/website/example.com/www下,目录下点击右键 Git提交->master,但是却发现必须输入“日志信息”否则无法提交?如果“日志信息”这个框没有输入内容,那个“确定按钮”就始终是灰色的。

4)为什么安装了之后右键菜单的这几个不是重复的吗?

安装完tortoiseGit Git这几个软件之后,右键菜单变得非常长。

1.Git add all file 这个是用来做将文件添加.git目录中配置好的远程github.com上吗?
如果是这样,那岂不跟 他下面的“Git提交到->master”功能一样了?(点击无反应)

2.Git Commit Tool 点击后弹出提交框,但是无法提交。是提交到那里去?

5)很多疑问,很多不解

1.仅仅是为了将本地的提交到远程github.com托管,
已安装了TortoisGit客户端后还必须安装git.exe吗

2.电脑Win7里面已安装了TortoisSVN,文件夹图标可以显示。
但安装后的TortoisGit文件夹图标不显示。是否是冲突?

3.右键菜单中的 这几项“Git add all file”、“Git commit tool”
功能是否跟TortoisGit 功能是重合的?
可否去掉,右键菜单太长了。

4.“Git 同步”是否就是“将本地的同步到远程”?
还是说“同步远程到本地”?点击后再点击弹出的面板上的“推送”
却需要输入Github.com的用户名,密码?
但是我使用“Git 提交->master”却不需要输入用户名密码。

一开始觉得原理应该很简单的,安装一个可以提交的客户端就可以了。但是现在却似乎不是想象的那样,弄得很晕。我使用SVN的时候安装TortoisSVN就可以用来提交了,其他什么都不需要安装。

巴扎黑
巴扎黑

reply all(7)
迷茫
  1. TortoisGit is a GUI version of git client, and git.exe is a command line tool. The functions of both are the same. You can install only one, but you will lose the convenience of the graphical interface/command line. As for GitHub for Windows, it is just a client of GitHub itself, so you don’t need to install it.
  2. This is how git stipulates, each warehouse has a directory. This directory will be placed in your target directory. It cannot exist in advance and git will create it
  3. Git’s regulations require you to write a comment every time you commit. Besides, this is also a good habit, isn’t it?
  4. git add ...Put the file under git management, and it will be submitted to the local warehouse the next time you commit.
  5. ……

    1. See you1
    2. This is not clear. You can look at the help of TortoisGit, but I don’t think so
    3. This should be added by different clients respectively. If you don’t install so many clients, you shouldn’t have so many menu items
    4. Git can perform two-way synchronization. push is to push the locally updated content to the remote end, and pull is to retrieve the remotely updated content to the local end

The principle of git is quite simple, but it is different from SVN. If you apply the concepts of SVN to git, you will confuse yourself.

我想大声告诉你

The first thing you need to understand is that the work of Git is different from that of Subversion: all operations of Subversion are directly performed on the server. Any viewing, adding files, and submissions you do directly operate the code base of the server. Using Subversion's thinking to understand Git, it can be understood that Git divides these operations into two steps. The first step is in the local code library, and the second step is in the remote code library (such as Github). These two steps are completed by different commands. (Instead of merging in one step like svn). The operations you do, except for a few commands such as clone, push, pull, fetch, ls-remote, etc., are for remote code base operations, and other operations such as viewing logs, adding files, submitting, branch management, reset, etc. are all operations. For local warehouse.
It is precisely because it is divided into local libraries and remote libraries that Git can be offline and distributed, unlike svn, which must be bound to a code base and must be online to operate.

Answer your question below:

`>1) Do all the following items have to be installed

In fact, you only need to install the git command line tool git-1.9.4-preview.exe, and nothing else is necessary

2) When creating a problem, the directory to which you clone must be empty?

Yes, the clone operation will create a new directory. If the directory already exists, should it be overwritten or merged? If you cover it, your original stuff will be lost. If merged, this warehouse will be mixed with other things.

If you know what you are doing, you don't have to delete this directory. Use these commands in this directory to merge the remote repository into your own repository.

git init
git remote add
git fetch

3) Right-click Git to submit->master. Remarks must be entered, otherwise it cannot be submitted?

correspondencegit commit命令,默认情况下提交commit必须要有comment。你可以提交一个没有comment的commit,不过得用命令行git commit --allow-empty-message

1.Git add all file Is this used to add files to the configured remote github.com in the .git directory?
If so, wouldn't it be the same as the "Git commit to ->master" function below? (No response when clicking)

When "Git add all file" corresponds to the command git add .,不是添加到远程github中,而是添加到本地仓库的cache里面,之后你做git commit, the submitted content is the files in the cache. Files that have not been added will not be included in the commit.

"Git commit to ->master" should not be submitted to the remote github, but only to the master branch of your local warehouse. If you don’t have a git add file yet, it means there are no changes to submit, and of course there will be no response. It is still recommended that you use the command line, which is the most intuitive and can clearly see any problems.

1. Just to host local submissions to remote github.com,
Do I still need to install git.exe after installing the TortoisGit client?

TortoisGit is just a "shell" for git. All operations are ultimately completed by calling the git command line. So git must be installed. In fact, I suggest you use the command line directly, which is more straightforward and easier to understand than the GUI. Easier.

2. TortoisSVN has been installed on the computer Win7, and the folder icon can be displayed.
But the TortoisGit folder icon does not display after installation. Is it a conflict?

A restart may be required.

3. These items in the right-click menu are “Git add all file” and “Git commit tool”
Does the function overlap with that of TortoisGit?
Can I remove it? The right-click menu is too long.

These menus should be generated by other tools? The corresponding command of Git add all file is git add .

4. Does "Git synchronization" mean "synchronizing local to remote"?
Or do you mean "synchronize remote to local"? Click and then click "Push" on the pop-up panel
But need to enter your Github.com username and password?
But when I use "Git commit->master", I don't need to enter the username and password.

Git's commit is actually only submitted to the local warehouse, unlike svn, which is submitted to the server. And "synchronization" is actually a push operation, which sends the local commit that has been submitted to another warehouse. Here. You don’t need a password to commit in the local warehouse, because it is your own warehouse. You need a password to push to the remote warehouse, because it is another warehouse.

给我你的怀抱

Github is so easy to use, but you understand how difficult it is to use. Many blog posts on the Internet have introduced it. How could you understand it like this? . . . svn and github are fundamentally different, don't compare them.

过去多啦不再A梦

Git focuses on command line operations. If you install git on a *nix system, it will be basically OK to run the command line.
There are many versions of graphics tools, and the higher the result, the more complicated it becomes.
It is recommended to familiarize yourself with the command line tools first, and then find a convenient graphical tool to use.

阿神

Someone upstairs gave a corresponding answer to your question. I would like to add some more content based on the original poster’s situation.

  • Visually, the author is new to Git and has experience using SVN before, so he unconsciously compares Git with SVN. I also used SVN first and then Git, so it is very simple. When learning to use Git, the original poster put aside the SVN thing for the time being and concentrated on studying related concepts in Git.
  • Look at my paragraph above, I only mentioned Git but not Github. Do you know why not? Because these two are indeed not the same thing, you first need to carefully check what Git is. If you don't figure this out, you won't be able to play anymore.
  • The host needs some introductory guidance. I would like to recommend an introductory guide written by me. I will continue to update the Git series introductory tutorials.

Finally I wish you good luck~

滿天的星座

You only need Github for Windows

As for other instructions, you can learn about them slowly
"Sync" is just one click

左手右手慢动作

Don’t use git if you don’t know how to type commands.
If you want to use it, use it well. Understand the basic data structure and commands before installation.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template