Git

From aoxoaWiki
Jump to navigationJump to search

git is a modern source code control system.


Topics

Resetting Passwords from the Console

Reference: Resetting Passwords

 cd /var/opt/gitlab
 gitlab-rails console production

Find user either by id, or by email:

  user = User.where(id: 1).first

or

  user = User.find_by(email: 'dan@aoxoa.com')

Change password (must do both!)

  user.password = 'newPassword'
  user.password_confirmation = 'newPassword'

Save:

  user.save!

Git Graphical UI Tools

So far i have tried a couple; still unsure which i prefer - i often find myself coming back to the command line. However, i'd really like to find a good tool that will help with merges.

My current favorite is GitHub Desktop.. (2021-11-06)

git-gui

Apparently this is supposed to come with git. It doesn't look like it is on my machine. AT some point i will have to try this (if only becuse it comes with git and therefore ought to work well with git...

OK, i take that back. I assumed you ran it with "git-gui". nope:

  git gui

But it might be an older version because it is throwing a Deprecation Warning on startup....

guitar

Website: https://github.com/soramimi/Guitar

This one has promise, but i couldn't get merging back into the main branch to work the way i expect. Otherwise it seemed nice.

Sourcetree

Website: https://www.sourcetreeapp.com/

This one is built by Atlassian. I used it a while ago and then stopped (not sure why). I am giving it another try.

GitHub Desktop

I am giving this a try right now. It seems to be working reasonably well no matter where the repo is (more than just GitHub).

Main Site: https://desktop.github.com/

Ubuntu: https://gist.github.com/berkorbay/6feda478a00b0432d13f1fc0a50467f1

  ## Follow this link for further updates to Github Desktop for Ubuntu https://github.com/shiftkey/desktop/releases/latest
  # UPDATE (2021-10-18): Thanks to Amin Yahyaabadi's message, the updated code is as follows
  
  sudo wget https://github.com/shiftkey/desktop/releases/download/release-2.9.3-linux3/GitHubDesktop-linux-2.9.3-linux3.deb
  ### Uncomment below line if you have not installed gdebi-core before
  # sudo apt-get install gdebi-core 
  sudo gdebi GitHubDesktop-linux-2.9.3-linux3.deb

Create a new Gitlab Project from Local Repository

In the situation where you have a local project and repository, you can create a new Gitlab project (as origin) as follows.

On Gitlab:

  • ensure that any program groups are created, ie: iphone
  • create a new project under that group
    • create a 'blank project'
    • set the project name, ie: Vehicles
    • ensure that the Project URL has the naming you want, ie: https://gitlab.com/aoxoa-iphone
    • and the 'project slug' is lowercased project name, ie: vehicles
    • enter something for the Project description
    • set Visibility Level to Private
    • click Create Project

Now, from the local repository:

  • take a look to see if there are any remotes already defined
  git -v remote
  • if there are any, you can rename them:
  git remote rename origin old-origin
  • ensure that git is clean and committed locally
  git add *
  git commit -m "prep for pushing to new origin on gitlab"
  • if there are branch naming issues, we can sort that out later
  • create linkage to remote and push everything (check url and names as appropriate):
  git remote add origin git@gitlab.com:aoxoa-iphone/vehicles.git
  git push -u origin --all
  git push -u origin --tags

bad config value for 'receive.denycurrentbranch' in ./config

Some web hosting service (like greengeeks/godaddy/etc) allow you to create a main git repo on your site. If it is configured/setup through cPanel, you may receive the following error when trying to push changes back to the main git repo:

  fatal: bad config value for 'receive.denycurrentbranch' in ./config
  fatal: Could not read from remote repository.
  
  Please make sure you have the correct access rights
  and the repository exists.

This is apparently caused by multiple versions of git on the remote repo, and seems to be a common issue with cpanel (see Stack Overflow article)

First SSH into the hosting machine, and find out the path to the version of git:

  which git-receive-pack
  /usr/local/cpanel/3rdparty/lib/path-bin/git-receive-pack

Now, after you have cloned the repo on your local machine (or anywhere else, and potentially every time you wipe the folder and start again)

  git config remote.origin.receivepack /usr/local/cpanel/3rdparty/lib/path-bin/git-receive-pack

Thereafter you should be able to push changes.

Online Resources

Lars Vogel's git Tutorial



Back to Main Page