Create new repostory at github and add new directory with files from terminal

Just use this script : committogithub.sh

  1. curl -u $1 https://api.github.com/user/repos -d "{\"name\":\"$2\"}"
  2. git init
  3. git add .
  4. git commit -a -m "added all"
  5. git remote rm origin
  6. git remote add origin "ssh://git@github.com/$1/$2.git"
  7. git remote -v
  8. git push -u origin master

Or Download it (commitnewfilestogithub.sh)


Usage : 


  1. sh committogithub.sh username reponame

Note : Make sure you have setup your ssh correctly for the system you are using at https://github.com/settings/ssh

No comments:

Post a Comment