Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react-native-git-upgrade fatal: working tree '.' already exists. #11578

Closed
hiaw opened this issue Dec 21, 2016 · 14 comments
Closed

react-native-git-upgrade fatal: working tree '.' already exists. #11578

hiaw opened this issue Dec 21, 2016 · 14 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@hiaw
Copy link

hiaw commented Dec 21, 2016

Description

Trying to upgrade using cli react-native-git-upgrade 0.39.2

Reproduction

~/D/D/M/R/_/Smish ❯❯❯ react-native-git-upgrade 0.39.2           dc/upgrade_39 ✭
git-upgrade info Check for updates
git-upgrade info Using yarn 0.18.1
git-upgrade info Read package.json files
git-upgrade info Check declared version
git-upgrade info Check matching versions
git-upgrade info Check React peer dependency
git-upgrade info Check that Git is installed
git-upgrade info Get information from NPM registry
git-upgrade info Upgrading to React Native 0.39.2, React ~15.4.0-rc.4
git-upgrade info Setup temporary working directory
git-upgrade info Configure Git environment
git-upgrade info Init Git repository
git-upgrade info Add all files to commit
git-upgrade info Commit current project sources
git-upgrade info Create a tag before updating sources
git-upgrade info Generate old version template
git-upgrade info Add updated files to commit
git-upgrade info Commit old version template
git-upgrade info Install the new version
error Command failed.
Exit code: 128
Command: git
Arguments: clone https://github.com/hiaw/react-native-layout-tester /Users/danielchong/Library/Caches/Yarn/.tmp/c055b13a602c46e87e94ee25168d3eb7
Directory: /Users/danielchong/Documents/Development/Mobile/React-Native/_client/Smish
Output:
fatal: working tree '.' already exists.
git-upgrade ERR! An error occurred during upgrade:
git-upgrade ERR! Error: Command 'yarn add [email protected] react@~15.4.0-rc.4' exited with code 1:
stderr: undefinederror Command failed.
Exit code: 128
Command: git
Arguments: clone https://github.com/hiaw/react-native-layout-tester /Users/danielchong/Library/Caches/Yarn/.tmp/c055b13a602c46e87e94ee25168d3eb7
Directory: /Users/danielchong/Documents/Development/Mobile/React-Native/_client/Smish
Output:
fatal: working tree '.' already exists.

stdout: yarn add v0.18.1
[1/5] Resolving packages...
[2/5] Fetching packages...
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

    at ChildProcess.child.on.code (/Users/danielchong/.node/lib/node_modules/react-native-git-upgrade/cliEntry.js:58:18)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
git-upgrade ERR! Restore initial sources
Note: checking out 'project-snapshot'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 54f0025... Project snapshot

I suspect it has to do with github dependency for react-native-layout-tester?

"devDependencies": {
  "babel-jest": "17.0.2",
  "babel-preset-react-native": "1.9.0",
  "jest": "17.0.3",
  "jest-react-native": "17.0.3",
  "react-native-components-viewer": "git+https://github.com/hiaw/react-native-components-viewer",
  "react-native-layout-tester": "git+https://github.com/hiaw/react-native-layout-tester",
  "react-test-renderer": "~15.3.1"
},

Solution

upgrade should work flawlessly

Additional Information

  • React Native version: 0.37.0
  • Platform: both
  • Operating System: MacOS
@EQuimper
Copy link

+1

@bd-arc
Copy link

bd-arc commented Jan 20, 2017

I can confirm this issue too while trying to upgrade to RN 0.40.0.

  • React Native version: 0.39.0
  • Platform: both
  • Operating System: MacOS

@yaronlevi
Copy link

yaronlevi commented Feb 7, 2017

+1
happens when I tried to upgrade from 0.40 to 0.41

@ncuillery
Copy link
Contributor

It has to do with the Git dependencies indeed. That should be fixed.

In the meantime, just remove them temporary from your package.jsonbefore running "react-native-git-upgrade".

@yaronlevi
Copy link

I solved it. For me running yarn instead of npm worked. The steps:

  1. clone a fresh copy of my repo (which is now at 0.40.0)
  2. run yarn
  3. run react-native-git-upgrade 0.41.0
    everything is fine!
    doing the same with npm didn't work.

@philohelp
Copy link

Same here. I just did yarn then react-native-git-upgrade and it worked.

@MaxwellGover
Copy link

I tried cloning a copy of my old repo (0.42.0), running yarn, and then running react-native-git-upgrade 0.43.0 and still getting fatal: working tree '.' already exists. error. I saw something about removing a package from package.json temporarily? How do you even do that? Looks like react-native-camera may be causing the issue?

{
  "name": "Snapshelf",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "firebase": "^3.7.2",
    "native-base": "^2.1.1",
    "react": "~15.4.1",
    "react-native": "0.42.0",
    "react-native-animatable": "^1.1.1",
    "react-native-camera": "git+https://github.com/lwansbrough/react-native-camera.git",
    "react-native-elements": "^0.9.7",
    "react-native-fetch-blob": "^0.10.2",
    "react-native-vector-icons": "^4.0.0",
    "react-redux": "^5.0.3",
    "redux": "^3.6.0",
    "redux-thunk": "^2.2.0"
  },
  "devDependencies": {
    "babel-jest": "19.0.0",
    "babel-plugin-root-import": "^5.1.0",
    "babel-preset-react-native": "1.9.1",
    "jest": "19.0.2",
    "react-test-renderer": "~15.4.1",
    "remote-redux-devtools": "^0.5.7"
  },
  "jest": {
    "preset": "react-native"
  }
}

@BigPun86
Copy link

BigPun86 commented Apr 9, 2017

i just had to run yarn before git-upgrade and everything is fine :)

@hramos
Copy link
Contributor

hramos commented Jul 20, 2017

Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally!

If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:

  • Does the issue still reproduce on the latest release candidate? Post a comment with the version you tested.
  • If so, is there any information missing from the bug report? Post a comment with all the information required by the issue template.
  • Is there a pull request that addresses this issue? Post a comment with the PR number so we can follow up.

If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.

@hramos hramos added the Icebox label Jul 20, 2017
@hramos hramos closed this as completed Jul 20, 2017
@wilr
Copy link

wilr commented Aug 30, 2017

git-upgrade info Check for updates
git-upgrade info Using yarn 0.27.5
git-upgrade info Read package.json files
git-upgrade info Check declared version
git-upgrade info Check matching versions
git-upgrade info Check React peer dependency
git-upgrade info Check that Git is installed
git-upgrade info Get information from NPM registry
git-upgrade info Upgrading to React Native 0.47.2, React 16.0.0-alpha.12
git-upgrade info Setup temporary working directory
git-upgrade info Configure Git environment
git-upgrade info Init Git repository
git-upgrade info Add all files to commit
warning: CRLF will be replaced by LF in android/gradlew.bat.
The file will have its original line endings in your working directory.
git-upgrade info Commit current project sources
git-upgrade info Create a tag before updating sources
git-upgrade info Generate old version template
git-upgrade info Add updated files to commit
warning: CRLF will be replaced by LF in android/gradlew.bat.
The file will have its original line endings in your working directory.
git-upgrade info Commit old version template
git-upgrade info Install the new version
error Command failed.
Exit code: 1
Command: git
Arguments: pull
Directory: /Users/Will/Library/Caches/Yarn/v1/.tmp/356e7fb1c51407d4d88112a3cfb3564c
Output:
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
git-upgrade ERR! An error occurred during upgrade:
git-upgrade ERR! Error: Command 'yarn add [email protected]' exited with code 1:
stderr: undefinederror Command failed.
Exit code: 1
Command: git
Arguments: pull
Directory: /Users/Will/Library/Caches/Yarn/v1/.tmp/356e7fb1c51407d4d88112a3cfb3564c
Output:
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

stdout: yarn add v0.27.5
[1/4] Resolving packages...
[2/4] Fetching packages...
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

    at ChildProcess.child.on.code (/usr/local/lib/node_modules/react-native-git-upgrade/cliEntry.js:58:18)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:194:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)

Upgrading to 0.47.2 displays the above notice. I've tried clearing the yarn cache without any luck.

@aditya27dev
Copy link

I was having the same issue, followed these steps and issue is resolved now:

run command yarn in your project folder and after that run react-native-git-upgrade

@jmatsushita
Copy link

I had to both use yarn to reinstall but also remove the following cache folder /Users/jun/Library/Caches/Yarn/v1/.tmp.

@galcivar
Copy link

galcivar commented Nov 5, 2017

Tried using yarn then react-native-git-upgrade without avail (also cleared the cache). I get:

git-upgrade info Install the new version
error Command failed.
Exit code: 128
Command: git
Arguments: clone https://github.com/GeekyAnts/react-native-drawer C:\Users\Gabriel\AppData\Local\Yarn\cache\v1.tmp\356e7fb1c51407d4d88112a3cfb3564c
Directory: C:\Users\Gabriel\Dropbox\React\native\chaski-react
Output:
fatal: working tree '.' already exists.
Error: Command failed.
Exit code: 128
Command: git
Arguments: clone https://github.com/GeekyAnts/react-native-keyboard-aware-scroll-view C:\Users\Gabriel\AppData\Local\Yarn\cache\v1.tmp\a3450fedabcb67009ae55c8f322f57b0
Directory: C:\Users\Gabriel\Dropbox\React\native\chaski-react
Output:
fatal: working tree '.' already exists.
at MessageError (C:\Program Files (x86)\Yarn\lib\cli.js:139:5)
at ProcessTermError (C:\Program Files (x86)\Yarn\lib\cli.js:158:1)
at ChildProcess.proc.on (C:\Program Files (x86)\Yarn\lib\cli.js:29937:15)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
git-upgrade ERR! An error occurred during upgrade:
git-upgrade ERR! Error: Command 'yarn add [email protected] [email protected]' exited with code 1:

@FlaviooLima
Copy link

In my case it was giving an error because of yarn no being able to read private repositories like this:

"react-native-elements": "git+https://github.com/*****/react-native-elements.git#Custom_Button",

Some open issue: issue1, issue2

@facebook facebook locked as resolved and limited conversation to collaborators Jul 20, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests