Advertisement
Guest User

Untitled

a guest
Aug 28th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. GITHUB_USERNAME=fastuous
  2. GITLAB_USERNAME=fastuous
  3. GITLAB_PRIVATE_TOKEN=~/.gitlab-private-token
  4.  
  5. # initializes git repo in current directory
  6. # repo gets initialized on gitlab using directory name as repo name
  7. gigl () {
  8. # if [ ! -e $$GITLAB_PRIVATE_TOKEN ]; then
  9. # echo "Error: No private token file found. Put your Gitlab private token into $GITLAB_PRIVATE_TOKEN"
  10. # return -1;
  11. # fi
  12. REPO=${PWD##*/}
  13. TOKEN=$(cat $GITLAB_PRIVATE_TOKEN)
  14. git init
  15. git remote add origin git@gitlab.com:$GITLAB_USERNAME/$REPO.git
  16. curl -H "Content-Type:application/json" https://gitlab.com/api/v3/projects\?private_token\=$TOKEN -d "{\"name\":\"$REPO\"}" | jq
  17. git add .
  18. git commit -m "Initial commit"
  19. git push -u origin master
  20. }
  21.  
  22. # initializes git repo in current directory
  23. # repo gets initialized on github using directory name as repo name
  24. gigh () {
  25. REPO=${PWD##*/}
  26. git init
  27. git remote add origin git@github.com:$GITHUB_USERNAME/$REPO.git
  28. curl -u "$GITHUB_USERNAME" https://api.github.com/user/repos -d "{\"name\":\"$REPO\"}" | jq
  29. git add .
  30. git commit -m "Initial commit"
  31. git push -u origin master
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement