March 30, 2016

github, go and hub=git

I had some a local files and directories in a local src directory that I wanted to push into a local github repository.  

Follow the  adding an existing project to github using the command line instructions.

Create:
git init
git add . -A
git commit -m "initial commit"
git remote add origin https://github.com/<username>/<repository>
git remote -v 

git push -u origin master

Update changes:
git add . -A 
git commit -m "add commit comment here"
git push origin master


If you messed up the repository settings with git instead og https:
git remote set-url origin https://github.com/<username>/<repository>

Then the repository should be ready for using github as an aliased git command set. Once you've got everything installed.

To ensure that your editors temporary files, apple DS_store files, etc are not added to your git repository, you'll have to create a .gitignore file in your local repository. Github has a nice tutorial here.  

If you need to remove some of these files you can use the find -exec rm trick.
find . -name '.DS_*' -exec rm -v {} \;

There's lots of information informtion about ignore rules in the git scm ducumentation. If you messed up something and want to permanently delete files and folders in your repository, here's a blog post on how to achieve that. And here's one for setting up your OSX keychain to handle passwords.

No comments: