2. Project management¶
GIT ADD COMMIT PUSH
This week I worked on planning my final project and started to getting used to the documentation process.
Installing Git and MkDocs on Mac¶
I used my inbuilt Git app in Terminal on my Mac to initiate Git. Though it sounds easy, I had a hard time doing so since this was my first time working on command line! First I had to install XCode for Mac to install Git on my computer.
Open Terminal and
cd to root folder
git --version git config –-global user.name “YOUR_USERNAME” git config --global user.email "insert your email id here" ssh-keygen -t rsa -C "$your_email" cat ~/.ssh/id_rsa.pub pbcopy < ~/.ssh/id_rsa.pub
Then I added this copied SSH key to the GIT web version by following this video
Installing Git in the right folder¶
Since I wasn’t familiar with command line, I ended up installing Git in my root folder. This creates an issue while trying to commit local files to repo. A small piece of code I missed was this:
I made a new folder to contain my Fabacademy website files
mkdir Fabacademy cd /Users/username/Fabacademy git clone [email protected]:academany/fabacademy/2019/labs/ied/students/abhay-prahaladhan.git
If git needs to be reinstalled or moved to another folder, you need to find the .git file in the root by viewing hidden files and deleting the .git folder and the local clone. This means redoing the config for git.
Additionally, every time we have to use Git, we need to navigate to the Git folder before typing commands. Also, I realised that while adding multiple files to be committed to git, it was easier to add the whole folder to commit.
git add . git commit -m 'message' git push
Now I could edit my files locally and push them to git without any issue!
Clearing Git history to reduce git repo size¶
I had tried changing my entire website from the ground up and then reverted to the old site. This resulted in my repository tripling in size of the original. This was due to git history storing all that data. In order to sort this, I followed this class recording and did the following steps:
cd to your site folder
git clone --bare site server ls
You should now see the server folder in your local.
cd to your site folder.
git push --set-upstream ../server master ls -al
you should still see your .git file on the list.
Now remove .git
rm -rf .git
git status should now bring you an error message saying its not a git repository.
git init to initiate git in the folder
git add . git commit -m 'message' git log
Now you should see only one commit listed in the log
now git push to the server
git push --force --set-upstream ../your_git_server master
This will overwrite the log and erase history, while retaining current files.
Now you should see only one commit listed in the log.
Installing MkDocs and localhosting issues¶
Since MkDocs was not natively supported on Mac, I installed Homebrew after ensuring that I had Python installed.
I edited the .yml file using textEdit to setup my MkDocs website theme. I’m new to HTML and website coding and I’m trying to evolve the website further.
I use XCode to edit the .md files that accept code in Markdown and HTML.