git clone后跟状态显示未跟踪的文件 [英] git clone followed by status shows untracked files

查看:1509
本文介绍了git clone后跟状态显示未跟踪的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对不起,我是一个git新手(虽然我非常熟悉像cvs和svn这样的旧版源代码控制系统)...

我的最终目标是通过在本地克隆该远程存储库,将文件添加到本地存储库,提交我的更改,然后将本地存储库推送回远程,将文件添加到远程存储库(一个不在我的计算机上)。

b
$ b

我试过这个:

  git clone ssh:// user @ server / Users / GitRepo / Project.git 
<本地创建文件>
git add< localfile>
git commit -mNarg
git push

但它只是说一切都是最新的。



所以我试着一步一步来,并且变得更加困惑。

  git clone ssh://user@server/Users/GitRepo/Project.git 
git status

它告诉我

 #目前没有任何分支
#未追踪的文件:
后跟一长串未追踪文件。

这看起来很奇怪,如果我只是克隆了存储库,为什么这些文件没有被跟踪?



如果它很重要,那么远程仓库是全新的,通过svn2git创建。



如果输入

  git remote show origin 

它告诉我:

  *远程原点
获取URL:ssh:// user @ server / Users / GitRepo / Project.git
Push URL:ssh://user@server/Users/GitRepo/Project.git
HEAD分支:master
远程分支:
跟踪的主数据
配置为'git pull'的本地分支:
主人与远程主人合并
为'git push'配置的本地参考:
主人推送给主人(最新)

如果我输入

  git branch -a 

它告诉我

  *(无分支)
主人
遥控器/ GitRepo / master
遥控器/原点/ HEAD - >原产地/主人
遥控器/原产地/主人

所以我只是困惑,实际上工作正常?或者我在做git命令错误?或者我创建的存储库不正确,所以没有git命令将正常工作?



谢谢,
Chris

解决方案

git config -l <​​/ code>



试试这个, > git config core.precomposeunicode false



这就是原因。 从这里


core.precomposeunicode
此选项仅适用于Git的Mac OS实施。当core.precomposeunicode = true时,Git会恢复由Mac OS完成的文件名的unicode分解。在Mac OS和Linux或Windows之间共享存储库时,这非常有用。 (需要Git for Windows 1.7.10或更高版本,或者在Cygwin 1.7下使用Git)。如果为false,那么Git会将文件名完全透明地处理,这与旧版Git向后兼容。



Sorry, I'm a git newbie (though I'm very familiar with older source control systems like cvs and svn) ...

My ultimate goal is to add a file to a remote repository (one not on my machine) by cloning that remote repository locally, adding the file to the local repository, committing my change, and then pushing my local repository back to the remote.

I tried this:

git clone ssh://user@server/Users/GitRepo/Project.git
<create file locally>
git add <localfile>
git commit -m "Narg"
git push

But it just says "Everything up to date".

So I tried going step-by-step, and got even more confused.

git clone ssh://user@server/Users/GitRepo/Project.git
git status

And it tells me

# Not currently on any branch
# Untracked files:
  followed by a long list of Untracked files.

Which seems really strange, why would the files be untracked if I just cloned the repository?

If it's important, the remote repository is brand-new, created via svn2git.

If I type

git remote show origin

it tells me

* remote origin
  Fetch URL: ssh://user@server/Users/GitRepo/Project.git
  Push  URL: ssh://user@server/Users/GitRepo/Project.git
HEAD branch: master
Remote branch:
   master tracked
Local branch configured for 'git pull':
   master merges with remote master
Local ref configured for 'git push':
   master pushed to master (up to date)

and if I type

git branch -a

it tells me

* (no branch)
master
remotes/GitRepo/master
remotes/origin/HEAD -> origin/master
remotes/origin/master

So am I just confused, and everything is actually working correctly? Or am I doing the git commands wrong? Or did I create the repository incorrectly, so no git commands will ever work properly?

Thanks, Chris

解决方案

git config -l

if current git repository's core.precomposeunicode=true

try this,

git config core.precomposeunicode false

and this is why. from here

core.precomposeunicode This option is only used by Mac OS implementation of Git. When core.precomposeunicode=true, Git reverts the unicode decomposition of filenames done by Mac OS. This is useful when sharing a repository between Mac OS and Linux or Windows. (Git for Windows 1.7.10 or higher is needed, or Git under cygwin 1.7). When false, file names are handled fully transparent by Git, which is backward compatible with older versions of Git.

这篇关于git clone后跟状态显示未跟踪的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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