Re: [git-users] Bash shell script to create GitHub repos from a Mac
Good point. I contracted the title from "A script containing Git commands that create a repo and uploads to GitHub". On Tue, Sep 27, 2016 at 8:17 AM, Konstantin Khomoutov < flatw...@users.sourceforge.net> wrote: > On Tue, 27 Sep 2016 06:56:06 -0700 (PDT) > Wilson Mar wrote: > > > I'd like your opinion of a shell script I created at: > > https://github.com/wilsonmar/git-utilities/blob/master/git- > sample-repo-create.sh > > > > I created it as part of my Master class on Git and GitHub > > to provide a way for people to see an entire sequence of Git commands. > > People can change something and see the impact on the chain of events > > and log outputs. > > > > The script is idempotent - it creates a new repo locally each run, > > but first deletes folders created from the previous run. > > > > Same thing with creating a repo. > > The script obtains a token from GitHub by providing a user's password, > > then uses the token to create a repo. > > On the next run it deletes the repo before starting again. > > > > The script pulls in a .secrets file containing the GITHUB_PASSWORD > > for the account and GITHUB_TOKEN. > > I have no idea what this script really does, but I'd like to warn you > that you possibly may be confusing Git with Github in your head -- I'm > judging from the name of the script and the repository it's located in. > > You should get this distinction very well understood: Git is a > standalone software package which makes no use of Github. Github is a > hosting provider for Git repositories, which adds a web interface to > manipulate the server-side replicas of your repositores, manage access > to them etc, and exposes a web API to do some of these manipulations in > an automatable way. > > Hence Github makes use of Git, but the reverse is not true. > That is, to start working with Git on an existing project, you just go > on and call `git init .` in the project's directory. That's all. > You do not even need a remote repository hosted somewhere: Git > repositories are completely free-standing. And if you need one, it's > not necessarily should be hosted by Github: it may be another directory > on your filesystem (or on a filesystem on your pendrive), it may reside > on a nearby computer, or on a corporate server. Or you can use another > public Git hosting provider such as Bitbucket. > > If you do understand all this stuff, please excuse me for reiterating > it. But in any case please do not confuse your users. This confusion > between Git and Github is a real thing, and it's bad because it > actually takes away from the knowledge of your users. > -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [git-users] Bash shell script to create GitHub repos from a Mac
On Tue, 27 Sep 2016 06:56:06 -0700 (PDT) Wilson Mar wrote: > I'd like your opinion of a shell script I created at: > https://github.com/wilsonmar/git-utilities/blob/master/git-sample-repo-create.sh > > I created it as part of my Master class on Git and GitHub > to provide a way for people to see an entire sequence of Git commands. > People can change something and see the impact on the chain of events > and log outputs. > > The script is idempotent - it creates a new repo locally each run, > but first deletes folders created from the previous run. > > Same thing with creating a repo. > The script obtains a token from GitHub by providing a user's password, > then uses the token to create a repo. > On the next run it deletes the repo before starting again. > > The script pulls in a .secrets file containing the GITHUB_PASSWORD > for the account and GITHUB_TOKEN. I have no idea what this script really does, but I'd like to warn you that you possibly may be confusing Git with Github in your head -- I'm judging from the name of the script and the repository it's located in. You should get this distinction very well understood: Git is a standalone software package which makes no use of Github. Github is a hosting provider for Git repositories, which adds a web interface to manipulate the server-side replicas of your repositores, manage access to them etc, and exposes a web API to do some of these manipulations in an automatable way. Hence Github makes use of Git, but the reverse is not true. That is, to start working with Git on an existing project, you just go on and call `git init .` in the project's directory. That's all. You do not even need a remote repository hosted somewhere: Git repositories are completely free-standing. And if you need one, it's not necessarily should be hosted by Github: it may be another directory on your filesystem (or on a filesystem on your pendrive), it may reside on a nearby computer, or on a corporate server. Or you can use another public Git hosting provider such as Bitbucket. If you do understand all this stuff, please excuse me for reiterating it. But in any case please do not confuse your users. This confusion between Git and Github is a real thing, and it's bad because it actually takes away from the knowledge of your users. -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[git-users] Bash shell script to create GitHub repos from a Mac
I'd like your opinion of a shell script I created at: https://github.com/wilsonmar/git-utilities/blob/master/git-sample-repo-create.sh I created it as part of my Master class on Git and GitHub to provide a way for people to see an entire sequence of Git commands. People can change something and see the impact on the chain of events and log outputs. The script is idempotent - it creates a new repo locally each run, but first deletes folders created from the previous run. Same thing with creating a repo. The script obtains a token from GitHub by providing a user's password, then uses the token to create a repo. On the next run it deletes the repo before starting again. The script pulls in a .secrets file containing the GITHUB_PASSWORD for the account and GITHUB_TOKEN. Let me know! // Wilson Mar -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. #!/usr/bin/env bash # git-sample-repo-create.sh from within http://github.com/wilsonmar/git-utilities. # by Wilson Mar (wilson...@gmail.com, @wilsonmar) # This script creates and populates a sample repo which is then # uploaded to a new repo created using GitHub API calls # Git commands in this script are meant as examples for manual entry # explained during my live "Git and GitHub" tutorials and # explained at https://wilsonmar.github.io/git-commands-and-statuses/) # This script is designed to be "idempotent" in that repeat runs # begin by deleting what was created: the local repo and repo in GitHub. # Sample call in MacOS Terminal shell window: # chmod +x git-sample-repo-create.sh # ./git-sample-repo-create.sh # Last tested on MacOS 10.11 (El Capitan) 2015-09-15 # TODO: Create a PowerShell script that works on Windows # Create blank lines in the log to differentiate different runs: echo "" echo "" echo "" echo "" echo "" # Make the beginning of run easy to find: echo "**" echo " STEP Delete \"$REPONAME\" remnant from previous run:" REPONAME='git-sample-repo' rm -rf ${REPONAME} mkdir ${REPONAME} cd ${REPONAME} CURRENTDIR=${PWD##*/} echo " Git version :" # After "brew install git" on Mac: git --version echo " STEP Init repo :" # init without --bare so we get a working directory: git init # return the .git path of the current project:: git rev-parse --git-dir ls .git/ echo " STEP Make develop the default branch instead of master :" # The contents of HEAD is stored in this file: cat .git/HEAD # Change from default "ref: refs/heads/master" : # See http://www.kernel.org/pub/software/scm/git/docs/git-symbolic-ref.html git symbolic-ref HEAD refs/heads/develop cat .git/HEAD git branch DEFAULT_BRANCH="develop" echo $DEFAULT_BRANCH echo " STEP Config (not --global):" # See https://git-scm.com/docs/pretty-formats : git config user.email "wilson...@gmail.com" git config user.name "Wilson Mar" # Username (not email) in GitHub.com cloud. git config user.user "wilsonmar" # Username (not email) in GitHub.com cloud. #GITHUBUSER=$(git config github.email) # Username (not email) in GitHub.com cloud. # echo $GIT_AUTHOR_EMAIL # echo $GIT_COMMITTER_EMAIL GITHUBUSER="wilsonmar" echo " GITHUBUSER=$GITHUBUSER " # After gpg is installed: # gpg --list-keys # gpg --gen-key git config --global user.signingkey 2E23C648 # Verify settings: git config core.filemode false # On Unix systems, ignore ^M symbols created by Windows: # git config core.whitespace cr-at-eol # Change default commit message editor program to Sublime Text (instead of vi): git config core.editor "~/Sublime\ Text\ 3/sublime_text -w" # Allow all Git commands to use colored output, if possible: git config color.ui auto # See https://git-scm.com/docs/pretty-formats : Add "| %G?" for signing # In Windows, double quotes are needed: git config alias.l "log --pretty='%Cred%h%Creset %C(yellow)%d%Creset | %Cblue%s%Creset' --graph" git config alias.s "status -s" #it config alias.w "show -s --quiet --pretty=format:'%Cred%h%Creset | %Cblue%s%Creset | (%cr) %Cgreen<%ae>%Creset'" git config alias.w "show -s --quiet --pretty=format:'%Cred%h%Creset | %Cblue%s%Creset'" git config alias.ca "commit -a --amend -C HEAD" # (with no message) # Have git diff use mnemonic prefixes (index, work tree, commit, object) instead of standard a and b notation: git config diff.mnemonicprefix true # Reuse recorded resolution of conflicted merges - https://git-scm.com/docs/git-rerere git config rerere.enabled false # git config --list # Dump config file echo " STEP commit (initial) README :" touch README.md git add . git commit -m "README.md" git l -1 echo " STEP amend commit README : " # ammend last commit with all uncommitted and un-staged changes: echo "some more\