Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Flask Basics Welcome to Flask First Steps

Brian Patterson
Brian Patterson
19,588 Points

I want to push a Flask project to Github.

I want to push a Flask project to Github. Each time I set this up I get an index.lock in Git. What is the best way to get around this. I have looked everywhere to solve this but I am guessing this is something to do with how Flask is setup in the virtualenv. So can some please help me get around this. Thanks for all your help.

3 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi Brian! It would be helpful to know exactly what the error is that you're getting. Is it that index.lock already exists? If this is the case, then try removing index.lock and do the commit and push. It could potentially be a permissions problem as well. Have you tried using sudo? Also, there could be another process trying to currently write to that file. Have you tried rebooting the system and then from the terminal/command line pushing it up to GitHub?

Try some of these things and see if one of them work for you! :sparkles:

Brian Patterson
Brian Patterson
19,588 Points

Please see below

fatal: Unable to create '/Users/briankaty1/Desktop/Developer/treehouse_flask/.git/index.lock': File exists.

Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.

Each time I do git add . the index.lock reappears! This only happens with Flask. Can someone please explain what is the right process. As I don't want to use Workspaces.

Brian Patterson
Brian Patterson
19,588 Points

```fatal: Unable to create '/Users/briankaty1/Desktop/Developer/treehouse_flask/.git/index.lock': File exists.

Another git process seems to be running in this repository, e.g. an editor opened by 'git commit'. Please make sure all processes are terminated then try again. If it still fails, a git process may have crashed in this repository earlier: remove the file manually to continue.

Each time I do git add . Then the index.lock reappears.  This has not happened in any of my other projects.
Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

It still sounds like some process is writing to that index.lock file. It even indicates this to be the problem in your error message. Can you confirm that once you've rebooted and without launching an IDE or doing anything else, that the commit and push fail from the command line?

Brian Patterson
Brian Patterson
19,588 Points

When I do git add . I get this

➜  treehouse_flask git:(master) βœ— git add .
[1]    7128 killed     git add .
➜  treehouse_flask git:(master) βœ— 

Then it writes index.lock to the .git folder.
I have already rebooted today. Why is it only happening in Flask?