Giter VIP home page Giter VIP logo

Comments (7)

driusan avatar driusan commented on September 23, 2024

Sorry for the long delay responding!

That looks like it should be correct to me. Can you see if it works if you remove the .git from the origin in your .git/config file? (It should work either with or without it, but I'm not sure if that's the cause of the problem since I don't have the extension on my checkouts..)

Is this on a repo cloned with the official git client or with dgit before doing the push with dgit?

As far as echoing passwords goes, it should work on any OS, it's just that there's no conceivable reason to use it (other than debugging it) on OSes that have the "real" git client. I plan to eventually look into seeing if I can make it use factotum on Plan 9, but before I spend too much effort on that I want to try and make sure that the basic use cases (like "git push"..) are working and well tested.

from dgit.

henesy avatar henesy commented on September 23, 2024

No problem!

Removing the .git in .git/config yields:

tenshi% git push master
origin  on  https://github.com/henesy/cs327
Username: henesy
Password: [Redacted]
Setting password  henesy [Redacted]
report-status
delete-refs
side-band-64k
quiet
atomic
ofs-delta
agent=git/github-g8e15c84d3743

Refname: refs/heads/master Remote Sha1: 144b0b6c01a09a723e2719760078dab7f01d2457 Local Sha1: 879af12b7b075168c2d68105122f0c9df7cfd899
1544HTTP/1.1 false 200 OK (-1)

000eunpack ok
0019ok refs/heads/master
00000000doneContent-Type [application/x-git-receive-pack-result]
Expires [Fri, 01 Jan 1980 00:00:00 GMT]
Cache-Control [no-cache, max-age=0, must-revalidate]
Vary [Accept-Encoding]
X-Github-Request-Id [95D6:28986:8444C7:E4F6A8:5A91F5BD]
Server [GitHub Babel 2.0]
Pragma [no-cache]
X-Frame-Options [DENY]

This appears to work! Seems a bit annoying with GitHub in this case as to clone the URL they give you ends in .git.

The repo was cloned by dgit on Plan 9. The echo'ing can't cook because Plan 9 doesn't use a terminal emulator, but raw mode still exists. Writing rawon to /dev/consctl sets raw mode for a given window on rio as per rio(4).

Thanks for the push tip, though! This is probably closed unless you feel like the .git in the config is a persistent issue of some sort.

from dgit.

driusan avatar driusan commented on September 23, 2024

It's definitely a bug that needs to be fixed, I think I just haven't noticed since go get doesn't use the .git variation of the URL.

It's a little surprising that it works without the .git but fails with, because the first thing it should do is try with the remote exactly as in the config, and the second thing it should do is add the .git and try again.. but at least there's a work around.

from dgit.

henesy avatar henesy commented on September 23, 2024

As for the raw mode comment, the following patch will set raw mode for password entry on Plan 9:

git/retrieve.go

231a232
> 		println("Setting password ", s.username, s.password)
262,269d262
< 
< 	// Set Raw Mode on Plan 9
< 	consctl, err := os.OpenFile("/dev/consctl", os.O_WRONLY, 0200)
< 	if err == nil {
< 		/* On Plan 9 */
< 		consctl.Write([]byte("rawon"))
< 	}
< 
271,276d263
< 
< 	// End Raw Mode on Plan 9
< 	if err == nil {
< 		consctl.Close()
< 	}
< 

I don't think this is a clean solution, should there be a platform-specific build somewhere that sets a raw toggle for different OS's?

Most platforms it would probably be sufficient to use golang.org/x/crypto/ssh/terminal's .RawMode(0). As Plan 9 doesn't use a terminal emulator hence the solution above for setting a raw rio window.

Thanks for the .gitconfig fix btw :)

from dgit.

driusan avatar driusan commented on September 23, 2024

If you can encapsulate it in a function like "ReadPassword" you could use build constraints (https://golang.org/pkg/go/build/) (for instance, git/editor.go and git/editor_plan9.go does it to handle the fact that the editor variable is capitalized on most OSes but lowercase on Plan 9.)

from dgit.

henesy avatar henesy commented on September 23, 2024

Patch for ReadPassword:

This should use raw mode on terminal emulators and plan 9, not sure what would be needed for windows, if that is even in the scope of this project.

git/retrieve.go

17a18,19
> var readPassword func(s *SmartHTTPServerRetriever)
> 
232d233
< 		println("Setting password ", s.username, s.password)
263c264,266
< 	s.password = readLine("Password: ")
---
> 
> 	readPassword(s)
> 

git/password_posix.go:

//+build !plan9

package git

import (
	"golang.org/x/crypto/ssh/terminal"
)

func init() {
	readPassword = func(s *SmartHTTPServerRetriever) {
		// Set Raw Mode on POSIX terminal emulators
		oldState, err := terminal.MakeRaw(0)
		if err != nil {
		        panic(err)
		}
		defer terminal.Restore(0, oldState)

	
		s.password = readLine("Password: ")
	}
}

git/password_plan9.go:

//+build plan9

package git

import (
	"os"
)

func init() {
	readPassword = func(s *SmartHTTPServerRetriever) {
		// Set Raw Mode on Plan 9
		consctl, err := os.OpenFile("/dev/consctl", os.O_WRONLY, 0200)
		if err == nil {
			/* see rio(4) */
			consctl.Write([]byte("rawon"))
		}
	
		s.password = readLine("Password: ")
	
		// End Raw Mode
		if err == nil {
			consctl.Close()
		}
	}
}

from dgit.

henesy avatar henesy commented on September 23, 2024

So pushing/cloning to/from GitHub can be done without the .git suffix.

git clone https://github.com/rakitzis/rc works for example and pushing works just fine as long as you never touch GitHub's *.git url. I think knowing that you just shouldn't use the .git suffix is sufficient for this.

from dgit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.