user11936976
user11936976

Reputation:

How to commit from a downloaded (.zip) repository?

To deploy my Laravel app to my server, I decided to just download the zip file and unzip it in the folder. However, I made some changes on my server and I would like to push them to GitHub. Since there is no .git folder, I don't get how am I supposed to commit the changes or pull from the repository.

Can you help me ?

Upvotes: 1

Views: 3501

Answers (2)

Adam Krawczyk
Adam Krawczyk

Reputation: 193

I've successfully done that following way:

  1. Rename repo zip downloaded (without .git)

mv repo repo-bak

  1. Clone original repo

git clone <url>

  1. move .git file to zip downloaded repo

mv repo/.git repo-bak

  1. delete cloned repo

rm -rf repo

  1. change the name back to the original

mv repo-bak repo

  1. add, commit and do whatever you want

cd repo && git status

Upvotes: 1

scottyfullstack
scottyfullstack

Reputation: 44

If you have a repo already that has commits do:

git clone git@REPO_LOCATION_INFO

Check out a new branch on your local:

git checkout -b branch-name

Make your changes, save, add, commit, and push them:

git add .
git commit -m "My commit message"
git push origin branch-name

then open a pull/merge request in your repository and merge to master.

Otherwise you can remote the folder on your local to your repository with:

git remote add origin [email protected]:user/repo_name

and then commit like shown above.

Hope this helps!

Upvotes: 3

Related Questions